Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Has anyone found a way to run C# Selenium RC tests in parallel?

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.

like image 433
Peter Bernier Avatar asked Sep 18 '08 13:09

Peter Bernier


1 Answers

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().

like image 110
Mark Avatar answered Oct 18 '22 20:10

Mark