简体   繁体   English

使用不同的测试用例运行SpecFlow测试

[英]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

https://github.com/unickq/Unickq.SeleniumHelper

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

相关问题 如何使用Specflow中的功能文件管理不同的测试用例 - How to manage different test cases with Feature file in Specflow 在Specflow / Selenium中运行多个测试时出错 - Error running multiple tests in Specflow/Selenium 在TFS2017中运行NUnit / SpecFlow测试 - Running NUnit/SpecFlow tests in TFS2017 是否可以将 Specflow 和 Selenium 中的自动化案例与 Microsoft 测试管理器相关联? - Is it possible to associate automatd cases in Specflow and Selenium to Microsoft Test Manager? 随机测试失败,session cannot be created error while running Test cases in selenium grid on docker on ZE96506A54E9557Z - Randomly Tests failed with session cannot be created error while running Test cases in selenium grid on docker on linux Test Explorer Specflow + VS2017 中的重复测试 - Duplicated tests in Test Explorer Specflow + VS2017 运行SpecFlow测试时Log4Net在Selenium Framework中不起作用 - Log4Net not working in Selenium Framework when Running SpecFlow Tests 记录功能Plone测试用例的Selenium测试 - Recording Selenium tests for functional Plone test cases 如何在一个测试中运行测试用例 - How to run tests cases in one test 使用jenkins运行selenium测试用例(测试用例在机器人框架中) - Running selenium test cases(Test cases are in robot framework) using jenkins
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM