views:

1926

answers:

5

Has anyone found a way to run Selenium RC / Selenium Grid tests, written in C# in parallel?

I've currently got a sizable test suite written using Selenium RC's C# driver. Running the entire test suite takes a little over an hour to complete. I normally don't have to run the entire suite so it hasn't been a concern up to now, but it's something that I'd like to be able to do more regularly (ie, as part of an automated build)

I've been spending some time recently poking around with the Selenium Grid project whose purpose essentially is to allow those tests to run in parallel. Unfortunately, it seems that the TestDriven.net plugin that I'm using runs the tests serially (ie, one after another). I'm assuming that NUnit would execute the tests in a similar fashion, although I haven't actually tested this out.

I've noticed that the NUnit 2.5 betas are starting to talk about running tests in parallel with pNUnit, but I haven't really familiarized myself enough with the project to know for sure whether this would work.

Another option I'm considering is separating my test suite into different libraries which would let me run a test from each library concurrently, but I'd like to avoid that if possible since I'm not convinced this is a valid reason for splitting up the test suite.

A: 

I don't know if no answer counts as an answer but I'd say you have researched everything and you really came up with the 2 possible solutions...

  • Test Suite runs tests in parallel
  • Split the test suite up

I am at a loss for any thing else.

Jeff Martin
A: 

Haven't used it for C# but I'm sure it works: Selenium Grid

Eric Wendelin
A: 

You can run NUnit tests with C# code. I cannot recall the NUnit namespace to use; a former programmer wrote a testing program to run all of our unit tests and I had a look at the code about a year ago. If I recall, the test program looked at all the assemblies in a folder and then reflected all of the classes looking for TestFixture decorated classes.

You could multi-thread the testing in your own code. There are a variety of ways to do this. I don't think you will get much benefit unless you are running on a multi-core system.

This might not be the answer you are looking for, but it will allow you to run unit tests in parallel.

Note: I am talking about driving the tests with C#, not just writing unit tests in C#. I believe you can use classes in the NUnit.Core.Util namespace. One approach would be to do testing for each assembly in a different thread.

Jason Jackson
A: 

Hi,

I wrote PNUnit as an extension for NUnit almost three years ago and I'm happy to see it was finally integrated into NUnit.

We use it on a daily basis to test our software under different distros and combinations. Just to give an example: we've a test suite of heavy tests (long ones) with about 210 tests. Each of them sets up a server and runs a client in command line running several operations (up to 210 scenarios).

Well, we use the same suite to run the tests on different Linux combinations and windows variations, and also combined ones like a windows server with a linux client, windows xp, vista, then domain controller, out of domain, and so on. We use the same binaries and then just have "agents" launched at several boxes.

We use the same platform for: balancing load test load -> I mean, running in chunks faster. Running several combinations at the same time, and what I think is more interesting: defining multi client scenarios: two clients wait for the server to start up, then launch operations, synch with each other and so on. We also use PNUnit for load testing (hundreds of boxes against a single server).

So, if you have any questions about how to set it up (which is not simple yet, I'm afraid), don't hesitate to ask.

Also I wrote an article long ago about it at DDJ: http://www.ddj.com/architect/193104810

Hope it helps

+3  A: 

I am working on this very thing and have found Gallio latest can drive mbUnit tests in parallel. You can drive them against a single Selenium Grid hub, which can have several remote control servers listening.

I'm using the latest nightly from Gallio to get the ParallelizableAttribute and DegreeOfParallelismAttribute.

Something things I've noticed is I cannot rely on TestSet and TestTeardown be isolated the parallel tests. You'll need the test to look something like this:

[Test] public void Foo(){
  var s = new DefaultSelenium("http://grid", 4444, "*firefox",
                              "http://server-under-test");
  s.Start();
  s.Open("mypage.aspx");
  // Continue
  s.Stop();

}

Using the [SetUp] attribute to start the Selenium session was causing the tests to not get the remote session from s.Start().

Mark
Thanks for your response. I've moved off of this project for the time being, but when I come back to it, I'll give your solution a shot!
Peter Bernier