我正在使用 Selenium 驱动程序使用 WebinatorSpecFlow+NUnit 开发 ASP.NET MVC 3 应用程序。我在使用 Chrome(使用 chromedriver)和 Internet Explorer 运行并行测试时遇到问题。
每当我在同一个 session 中运行两个测试并通过 Webinator 由 Selenium 并行运行时,当我向页面发送任何点击操作时,IE 似乎挂起。
我无法使用建议的解决方案 here ,因为 SpecFlow 会自动生成底层 C# 代码。我的解决方案设计为 this (完整代码作为要点提供):
_multipleBrowsers.RunTest(web => web.GoToUrl("http://localhost/PROJECT/Authentication/Registration"));
我会为每个需要测试的浏览器实例化一个新的 IWebManager。然后,我使用浏览器实例调用委托(delegate)操作。它是这样的:
foreach (var web in _webManagers)
{
Debug.WriteLine("Running test with " + web.Config.Browser);
action(web);
}
这样测试几乎是并行进行的。它会弹出一个浏览器,执行操作,然后是另一个浏览器,依此类推。
关于如何解决这个 ChromeDriver 问题有什么想法吗?我是否应该使用 SpecFlow 更改针对多个浏览器的测试方法?
引用资料:
最佳答案
你可以更简单just use
然后你用标签@Browser:IE 编写功能
@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
目前是我找到的最好的解决方案,因为它不仅在所有浏览器中进行测试,而且在您需要的特定浏览器中进行测试也是有意义的
关于c# - 使用 Webinator+Selenium、SpecFlow 和 NUnit 的多浏览器测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11471198/