How can I run all my selenium tests sequentially in C#?

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.

  • Answer:

    I am working on this very thing and have found http://www.gallio.org/ latest can drive mbUnit tests in parallel. You can drive them against a single http://selenium-grid.seleniumhq.org/ hub, which can have several remote control servers listening. I'm using the http://ccnet.gallio.org/Distributables/ to get the http://www.gallio.org/api/html/T%5FMbUnit%5FFramework%5FParallelizableAttribute.html and http://www.gallio.org/api/html/T%5FMbUnit%5FFramework%5FDegreeOfParallelismAttribute.html. 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().

Peter Bernier at Stack Overflow Visit the source

Was this solution helpful to you?

Other answers

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

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

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.