RenMG
RenMG

Reputation: 71

Using NUnit v3 alpha how can i get my TestFixtures to run in parallel after noting [Parallelizable(ParallelScope.Fixtures)]

Using NUnit v3 I have added [Parallelizable(ParallelScope.Fixtures)] to 2 separate [TestFixtures].

The positive is they run, the negative is they do not run in parallel, is there a syntax i'm missing that needs to be noted in the code? I've looked and currently in alpha they support running TestFixtures in parallel not tests within a Fixture.

However I do not see my tests running in parallel. My target is Sauce Labs.

[TestFixture, Description("IE10, Launch url, verify elements, log in, verify landing page")]

//will run test fixtures in parallel

[Parallelizable(ParallelScope.Fixtures)]

and

//second series of tests to run in parallel
[TestFixture, Description("IE9, Launch url, verify elements, log in, verify landing page")]

//will run test fixtures in parallel

[Parallelizable(ParallelScope.Fixtures)]

Each test runs linearly and succeeds, Running at the TestFixture level for my purpose works. However I feel like i'm missing a concept here.

any help would be great to help me figure out why this wouldn't be working.

thanks Ren

Upvotes: 4

Views: 3094

Answers (2)

Andrew
Andrew

Reputation: 412

Here's how I just run selenium tests in parallel using nunit-console.

  • Updated tests project to use newest NUnit assembly
  • Updated obsolete attributes. You can find complete list here.
  • Added the following lines to each class, which I want to run in parallel:

    [TestFixture]
    [Parallelizable(ParallelScope.Fixtures)]
    
  • Run NUnit console using this command line:

    nunit-console.exe C:\Path\My.Tests.dll --include=Selenium --result=TestResult.xml;format=nunit2 --workers=4
    

Upvotes: 0

RyanR
RyanR

Reputation: 11

Are your two TestFixtures doing the same thing? If they are maybe try having only one TestFixture class and having two TestFixture attributes.

[TestFixture("chrome", "WIN8")]
[TestFixture("firefox", "WIN8")]
[Parallelizable(ParallelScope.Fixtures)]
public class RDTestFixture
{
    public RDTestFixture(string browser, string os)
    {   
        DesiredCapabilities capability = new DesiredCapabilities();
        capability.SetCapability("browserName", browser);
        capability.SetCapability("platform", os);
        driver = new RemoteWebDriver(new Uri("http://10.168.88.131:4444/wd/hub/"), capability); //address of the GRID hub
        driver.Manage().Window.Maximize();
     }

This just ran directly on selenium grid as opposed to Sauce Labs and both ran in parallel.

Upvotes: 1

Related Questions