How can I run NUnit(Selenium Grid) tests in parallel?

11,797

Solution 1

There hasn't been a lot of work on this subject. I didn't find anything really relevent.

However, your point is well taken. Most machines nowadays have more cores and less powerful cores compared to powerful one core cpu.

So I did find something on a Microsoft blog. The technology is called PUnit and is made especially for testing multi-threaded environment.

It's as close as possible to what you requested that I could find :)

You can visit it the appropriate blog post right there: http://blogs.microsoft.co.il/blogs/eyal/archive/2008/07/09/punit-parallel-unit-testing-in-making.aspx

Update: Link is not valid anymore. The project on CodePlex has been removed.

Update2: This is on the roadmap for NUnit 2.5. Reference

Solution 2

NUnit version 3 will support running tests in parallel, this works good with a Selenium Grid:

Adding the attribute to a class: [Parallelizable(ParallelScope.Self)] will run your tests in parallel with other test classes.

• ParallelScope.None indicates that the test may not be run in parallel with other tests.

• ParallelScope.Self indicates that the test itself may be run in parallel with other tests.

• ParallelScope.Children indicates that the descendants of the test may be run in parallel with respect to one another.

• ParallelScope.Fixtures indicates that fixtures may be run in parallel with one another.

NUnit Framework-Parallel-Test-Execution

Share:
11,797
Benjamin Lee
Author by

Benjamin Lee

Updated on June 18, 2022

Comments

  • Benjamin Lee
    Benjamin Lee almost 2 years

    My current project uses NUnit for unit tests and to drive UATs written with Selenium. Developers normally run tests using ReSharper's test runner in VS.Net 2003 and our build box kicks them off via NAnt.

    We would like to run the UAT tests in parallel so that we can take advantage of Selenium Grid/RCs so that they will be able to run much faster.

    Does anyone have any thoughts on how this might be achieved? and/or best practices for testing Selenium tests against multiple browsers environments without writing duplicate tests automatically?

    Thank you.