Question

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.

Was it helpful?

Solution

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

OTHER TIPS

I struggled with both these problems myself. In the end I developed a custom Nunit test runner that is capable of running multiple tests in parrallel. This combined with the Taumuon.Rakija extension for nunit allowed the tests to be dynmaically created depending on which browser you want the test to run on.

I'm now in a position where I can launch my test suite against as many browser types on as many operating systems as I wish in parrallel.

Unfortunately there doesn't seem to be a good solution to these problems already so you'll probably have to solve them yourself for your particular environment.

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

Igor Brejc has a blog post about running tests in parallel using MbUnit.

However he does say "Once we integrate Selenium into acceptance testing", so it looks like he was just experimenting, I can't find any other posts so I don't know if he has successfully run Selenium tests in parallel.

http://igorbrejc.net/development/continuous-integration/gallio-running-tests-in-parallel

You can use the Task Parallel Library and the DynamicObject class to achieve parallelization of the same test on multiple browsers. See my article Running Selenium In Parallel with any .NET Unit Testing Tool for details.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top