14

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.

Peter Bernier
  • 7,868
  • 5
  • 36
  • 52

3 Answers3

5

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
  • 9,396
  • 6
  • 35
  • 39
  • 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 Mar 05 '09 at 13:47
1

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

0

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
  • 9,895
  • 6
  • 46
  • 67