多个浏览器使用Webinator + Selenium,SpecFlow和NUnit进行测试

我正在使用Selenium驱动程序使用WebinatorSpecFlow + NUnit开发ASP.NET MVC 3应用程序。 我在使用Chrome(使用chromedriver)和Internet Explorer运行并行测试时遇到问题。

每当我在同一个会话中运行两个测试并通过Webinator并行运行Selenium时,当我向页面发送任何单击操作时,IE似乎都会挂起。

我无法使用此处建议的解决方案,因为SpecFlow会自动生成基础C#代码。 我的解决方案是这样设计的(完整代码可作为要点):

_multipleBrowsers.RunTest(web => web.GoToUrl("http://localhost/PROJECT/Authentication/Registration")); 

会发生什么是我为每个需要测试的浏览器实例化一个新的IWebManager。 然后,我使用浏览器实例调用委托操作。 它是这样的:

  foreach (var web in _webManagers) { Debug.WriteLine("Running test with " + web.Config.Browser); action(web); } 

这样,测试几乎并行运行。 它会弹出浏览器,执行操作,然后弹出其他浏览器,等等。

有关如何克服此ChromeDriver问题的任何想法? 我应该使用SpecFlow为多个浏览器更改我的测试方法吗?


参考文献:

  • Webinator
  • specflow
  • NUnit的
  • ChromeDriver

你可以更简单地使用它

然后用标签@Browser:IE编写function

 @Browser:IE @Browser:Firefox Scenario: Add comments Given I navigated to /guinea-pig And I have entered 'This is not a comment' into the commentbox When I press 'submit' Then my comment 'This is not a comment' is displayed on the screen 

现在是我找到的最好的解决方案,因为它也可以在所有浏览器中进行测试,但不是针对您需要的具体测试