4

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.

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.

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"));

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.

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


References:

Community
  • 1
  • 1
Leonardo Eloy
  • 2,633
  • 2
  • 14
  • 13

2 Answers2

3

You can that much more simpler just use

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

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

Vova Bilyachat
  • 18,765
  • 4
  • 55
  • 80
1

I've created a new SpecFlow plugin that achieves the upvoted comment. It supports SpecFlow 3 (which means core too).

It also works with either MsTest, NUnit and xUnit.

https://github.com/TotalTest/SpecFlow.Contrib.Variants

The scenario and how it looks in test explorer can be seen here: img

But essentially you can do either:

@Browser:Chrome
@Browser:Firefox
Feature: AnExampleFeature

or

@Browser:Chrome
@Browser:Firefox
Scenario: AnExampleScenario

And the scenarios will run for each browser

Prab G
  • 346
  • 3
  • 11
  • While an external link is helpful, best practice is to include all the key details in your post. This way if something happens to the repo on GitHub, your answer on stackoverflow is still useful & valid. – Simon.S.A. Apr 16 '20 at 20:47