如何并行运行specflow功能文件? [英] How to run specflow feature files in parallel?
问题描述
我在Saucelabs上将Specflow与NUnit一起使用.我需要并行运行功能文件. 但是我读到某个地方,如果您正在使用ScenarioContext/FeatureContext,那么您将无法并行运行该脚本,而我目前正在几乎所有测试场景中都使用它.是真的吗如果为true,我可以使用什么替代方法进行多线程处理. 请注意,功能之间或功能中的测试用例之间没有依赖关系. 任何人都可以提供代码段来帮助我实现并行执行. 感谢您的提前帮助.
I am using specflow with NUnit on Saucelabs. I need to run features files in parallel . But I read somewhere that you cannot run in parallel if you are using ScenarioContext/FeatureContext which I am currently using in almost every test scenario. Is it true ? If true , what alternative can I use for multi threading. Please note that there is no dependency between the features or between the testcases in features. Can anyone provide a code snippet to help me implement parallel execution. Thanks for the help in advance.
[如果不是并行的功能文件,请在并行运行功能文件中的测试场景时做指导]
[If not feature files in parallel , please do guide in running test scenarios within a feature file in parallel]
推荐答案
如果要使一个项目中的所有测试都以串行方式运行,请将以下内容添加到项目的AssemblyInfo类中:
If you want to make all your tests within one project run in serial add the following to the project's AssemblyInfo class:
[assembly: CollectionBehavior(DisableTestParallelization = true)]
这篇关于如何并行运行specflow功能文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!