[英]Running SpecFlow tests with different test cases
NUnit (and the like) has method attributes which allow tests to be run multiple times with different arrange values. NUnit(等等)具有方法属性,该属性允许使用不同的排列值多次运行测试。 Is something similar possible with SpecFlow?
SpecFlow可能有类似的可能吗?
What I am aiming for is a way to run the same scenario tests in a feature file with as many browser drivers as I can, in one test run. 我的目标是在一种测试运行中,以尽可能多的浏览器驱动程序在功能文件中运行相同的方案测试。
You can use scenario outlines. 您可以使用方案大纲。 In example of scenario outline you can mention driver name and you code logic should take action according to driver.
在方案概述的示例中,您可以提及驱动程序名称,并且代码逻辑应根据驱动程序采取措施。 Please see more details about scenario ouyline below
请在下面查看有关方案ouyline的更多详细信息
https://github.com/cucumber/cucumber/wiki/Scenario-outlines https://github.com/cucumber/cucumber/wiki/Scenario-outlines
Examples are one solution, but in your case a little cumbersome, as you have to specify them at every scenario. 示例是一种解决方案,但在您的情况下有点麻烦,因为您必须在每种情况下都指定它们。
In your case, please have a look at the targets feature of the SpecFlow+Runner. 在您的情况下,请查看SpecFlow + Runner的目标功能。 With that you can "multiply" your scenarios for different configurations.
这样,您可以针对不同的配置“乘以”方案。 If you put the web driver that should be used in this configuration, you can test as many webdriver as you want.
如果您在此配置中放置了应该使用的Web驱动程序,则可以根据需要测试任意数量的Web驱动程序。
Have a look at this example: https://github.com/techtalk/SpecFlow.Plus.Examples/tree/master/SeleniumWebTest 看一下这个例子: https : //github.com/techtalk/SpecFlow.Plus.Examples/tree/master/SeleniumWebTest
Full Disclosure: I am one of the developers of SpecFlow & SpecFlow+ 全面披露:我是SpecFlow和SpecFlow +的开发商之一
Use scenario outlines and this tool if you want to use browsers as tags: https://github.com/unickq/Unickq.SeleniumHelper 如果要将浏览器用作标记,请使用方案概述和此工具: https : //github.com/unickq/Unickq.SeleniumHelper
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.