如何在不共享Webdriver的情况下并行运行specflow测试?

问题描述 投票:0回答:1

我有一个运行specflow和selenium的测试解决方案,直到现在我设法通过为所有测试场景共享一个Webdriver来并行运行测试,但现在我遇到了一些设置问题。如何在不共享单个webdriver的情况下与Nunit并行运行selenium测试?

c# selenium webdriver specflow parallel-testing
1个回答
0
投票

最好的办法是为每个场景配备一个新的WebDriver。 我们在这里有一个示例如何:https://github.com/techtalk/SpecFlow.Plus.Examples/tree/master/SeleniumWebTest

它的作用是将WebDriver封装在它自己的类(https://github.com/techtalk/SpecFlow.Plus.Examples/blob/master/SeleniumWebTest/TestApplication.UiTests/Drivers/WebDriver.cs)中。

由于实例保存在SpecFlow的DI容器中,因此您将获得每个方案的新实例。

© www.soinside.com 2019 - 2024. All rights reserved.