简体   繁体   English

BDD和UI测试

[英]BDD and UI Testing

Here's a question... 这是个问题

We have a WPF MVVM application using IronRuby. 我们有一个使用IronRuby的WPF MVVM应用程序。 We use the DevExpress dock manager. 我们使用DevExpress基座管理器。 We have cucumber tests (getting it to work on IronRuby was our team lead's via dolorosa) 我们已经进行了黄瓜测试(使其在IronRuby上运行是我们团队负责人通过dolorosa进行的)

Part of our requirements is allowing the user to save the layout of their screen. 我们的部分要求是允许用户保存其屏幕布局。 What's a good way to wrap BDD tests around this? 围绕此包装BDD测试的好方法是什么?

The layout is saved when the user closes the app. 当用户关闭应用程序时,将保存布局。

Here is my first idea. 这是我的第一个主意。

  1. Have cucumber open the app. 让黄瓜打开应用程序。
  2. Have cucumber use bewildr and/or white to move stuff about. 让黄瓜用迷糊剂和/或白色调料。 (It's hard to simulate a user moving the layout about.) (很难模拟用户在其中移动布局。)
  3. Take a screenshot or something. 拍摄屏幕截图或其他内容。
  4. Close the app. 关闭应用程序。
  5. Open the app again. 再次打开该应用。
  6. Take a screenshot or something. 拍摄屏幕截图或其他内容。
  7. Compare the screenshots or something 比较屏幕截图或其他内容

See, while that would work, I think its a convoluted way to get things done. 看到,虽然这可行,但我认为这是完成工作的复杂方法。 I was hoping somebody here can give me a suggestion on what "something" in the above steps could be. 我希望这里有人可以对上述步骤中的“内容”给出建议。

White is based on UI Automation, and if it doesn't support docking and bounding rectangles you can always dig into the UI Automation patterns and use those. White基于UI自动化,如果它不支持停靠和定界矩形,则可以随时挖掘UI Automation模式并使用它们。 Try using DockingPattern and BoundingRectangleProperty on the panels you're interested in. That should allow you to record where they're docked and what size they are, at least. 尝试在您感兴趣的面板上使用DockingPatternBoundingRectangleProperty 。这至少应允许您记录它们停靠的位置和大小。

Also remember that you don't need to write automated scenarios for everything . 还要记住,您不需要为所有内容编写自动化方案。 Aesthetic and usability concerns are often better tested manually, since they have no benefit if the users don't like them, regardless of what the automated tests believe. 审美和可用性问题通常可以通过手动方式进行更好的测试,因为如果用户不喜欢它们,无论自动化测试如何相信,它们都将无济于事。 The scenarios are there to ensure a common understanding - through the conversations they drive - and to help keep things easy to change - by providing documentation and a safety net. 通过提供文档和安全网,可以确保通过各种场景进行共识-通过他们进行的对话-并使事情易于更改。 If you're never going to change your docking mechanism (because it's a 3rd party app) then just test it manually and leave it alone. 如果您永远都不想更改对接机制(因为它是第三方应用程序),则只需手动对其进行测试,就不用管它了。

Bewildr elements will have 'width' and 'height' methods available in the next release (a few days from now - the code's checked in and working). Bewildr元素将在下一个版本中(从现在开始数天-检入并工作的代码)提供'width'和'height'方法。 I guess you could use them to get the size of the element to see if it remains the same across app-restarts. 我猜您可以使用它们来获取元素的大小,以查看它在应用程序重新启动之间是否保持不变。 You could also use the 'clickable_point' method to tell whether the clickable point of the element (usually the center point) moves across app-restarts - a bit hacky but it would work... 您还可以使用'clickable_point'方法来判断元素的可点击点(通常是中心点)是否在应用重新启动过程中移动-有点棘手,但它可以工作...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM