使用Webinator +硒,SpecFlow和NUnit多个浏览器测试 [英] Multiple Browsers Tests using Webinator+Selenium, SpecFlow and NUnit

查看:597
本文介绍了使用Webinator +硒,SpecFlow和NUnit多个浏览器测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发使用Selenium的驱动程序WebinatorSpecFlow + NUnit的一个ASP.NET MVC 3应用程序。我在运行并行测试,浏览器(使用chromedriver)和Internet Explorer的一个问题。

I'm developing an ASP.NET MVC 3 app with WebinatorSpecFlow+NUnit using the Selenium driver. I'm having a problem running parallel tests with Chrome (using chromedriver) and Internet Explorer.

每当我不得不通过硒在同一个会话和同时运行两个测试。Webinator,IE浏览器似乎挂起当我发送的任何点击动作页面

Whenever I have both tests running in the same session and in parallel by Selenium via Webinator, IE seems to hang when I send any click action to the page.

我不能使用该解决方案建议的here~~V ,因为SpecFlow自动生成底层的C#代码。我的解决方案是专如(完整的代码可以作为一个依据):

I'm not able to use the solution suggested here, since SpecFlow generates the underlying C# code automatically. My solution is designed like this (the full code is available as a gist):

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



什么情况是,我实例化每一个浏览器我需要测试一个新的IWebManager。然后,我打电话委托作用,使用浏览器实例。它是这样的:

What happens is that I instantiate a new IWebManager for every browser I need to test. Then, I call the delegate action, using the browser instance. It goes like this:

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

            action(web);
        }



这样的测试几乎并行运行。它会弹出一个浏览器,执行行动,那么其他的浏览器,等等。

This way the tests run almost in parallel. It pops up a browser, execute the action, then the other browser, and so forth.

这是如何克服这个问题ChromeDriver什么想法? ?我应该改变我的SpecFlow测试方法对多个浏览器

Any thoughts on how to overcome this ChromeDriver issue? Should I change my testing approach with SpecFlow for multiple browsers?

参考文献:

  • Webinator
  • specflow
  • nunit
  • ChromeDriver

推荐答案

您可以在更简单的只需使用

然后你写的功能,以标签@Browser:IE

Then you write feature with tag @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

有关现在我发现,因为它也做出最佳的解决方案SENCE在所有浏览器,但具体哪些需要

For now is the best solution which i found since it also make sence to test not in all browsers but in specific which you need

这篇关于使用Webinator +硒,SpecFlow和NUnit多个浏览器测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆