简体   繁体   English

如何在FitNesse测试用例中添加按钮?

[英]How to add a button in FitNesse Test case?

The scenario is as follow: I want to pause the test when it encounters the Button in the Wiki page Test Scenario. 该场景如下:当我在Wiki页面“测试场景”中遇到“按钮”时,我想暂停测试。 It should wait until the user presses the Button and once the button is pressed the test should continue. 它应该等到用户按下按钮,并且一旦按下按钮,测试就应该继续。

As the automated tests are designed to run in a full set without any monitoring or midway user interaction, this is not a standard feature. 由于自动测试旨在在没有任何监视或用户中间干预的情况下完整运行,因此这不是标准功能。 Feel free to edit the source where needed and recompile. 随时在需要的地方编辑源代码并重新编译。

Since you tagged this question with Selenium-fitnesse-bridge, my assumption is that you are testing the browser user interface of an application via Selenium webDriver, but instead of driving the tests from xUnit you are driving from fitnesse. 由于您使用Selenium-fitnesse-bridge标记了这个问题,因此我的假设是,您正在通过Selenium webDriver测试应用程序的浏览器用户界面,但不是从xUnit驱动测试,而是从Fitnesse驱动。

First, this isn't really the sweet spot of fitnesse - it's main purpose is to test business logic by interacting with System Under Test as opposed to running end-end tests by driving a browser - however, that soap box aside, you are creating fixtures for fitnesse to interact with - and those fixtures currently contain webdriver code. 首先,这并不是fitnesse的真正优点-它的主要目的是通过与被测系统进行交互来测试业务逻辑,而不是通过驱动浏览器来运行最终测试-但是,撇开肥皂盒,您正在创建用于fitnesse与之交互的固定装置-并且这些固定装置当前包含webdriver代码。 So you can put the pause inside your fixture class. 因此,您可以将停顿放到夹具类中。 I'd need to see your test table and whether you are using Slim or not to get an idea of where the logical place in your fixture code to place the wait would be. 我需要查看您的测试表以及您是否正在使用Slim,以了解夹具代码中逻辑位置的位置。

The only problem with that solution is if you want to specify on the fixture page that there should be a wait at a certain point - you don't just want it behind the scenes in the webdriver code. 该解决方案的唯一问题是,如果您想在Fixture页面上指定在某个特定时刻应该等待-您不只是希望它在webdriver代码中在幕后。 In that case, you could probably use a ScriptTable style of fixture ( http://www.fitnesse.org/FitNesse.UserGuide.WritingAcceptanceTests.SliM.ScriptTable ) and have a command in the script that maps to a method that waits for the specified amount of time or for a specified element to be visible. 在这种情况下,您可能会使用ScriptTable样式的固定装置( http://www.fitnesse.org/FitNesse.UserGuide.WritingAcceptanceTests.SliM.ScriptTable ),并在脚本中有一个命令映射到等待指定的时间量或使指定的元素可见。

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

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