Specflow scenarios with NUnit test parameters

时间:2015-12-03 10:37:45

标签: selenium nunit bdd specflow

When using NUnit, you can pass in parameters to your tests using TestCaseSourceAttribute.

[Test, TestCaseSource(typeof(WebDriverFactory), "Drivers")]

What would be the best approach to doing the same for tests generated using specflow? Those tests do not use the 'Test' attribute. They use 'Given', 'And', 'Then' etc.

I'm trying to pass in different web drivers (selenium) so I don't have to manually change them to test across different browsers.

1 个答案:

答案 0 :(得分:1)

Specflow自动创建测试装置,因此您无法使用[NSDate date]。您可以尝试Test class generator to drive automated web ui tests with Selenium and SpecFlow

但是你应该问自己,在不同浏览器中执行Specflow场景是否会给你的项目带来很多好处,因为你的验收测试的执行时间会翻倍/三倍。根据我的经验,跨浏览器测试识别UI变化和非常罕见的功能(说实话,我从来没有遇到任何)。在我们的团队测试人员中手动执行。