3

I am using jUnit's Parameterized annotation on some Selenium tests to specify the browsers they should run with. I am also using SureFire's new parallel parameter (set to "classes") to try and run them in parallel. Am I correct in assuming that if I have X test classes and Y browsers, I should see X*Y windows pop up, X of each type? I'm only seeing Y windows pop up at a time.

For example, let's say I have my parameter list set to Firefox and Chrome, and I have 10 test classes. When I execute the tests with Maven, I'm seeing one Firefox window and one Chrome window appear on my remote server at a time. I want to see 10 of each, one for each class, so it takes less time to run. Is this possible?

3
  • You have to create a own Parameterized class like here: stackoverflow.com/questions/13504796/… But be careful. I used this too and had some troubles with the number of parallel tests. Therefor this is not a answer. I think it is not the best way. But I have no other idea.
    – Twaldigas
    Commented Jun 26, 2014 at 6:31
  • @Twaldigas I was using something like that (actually the one provided by Sauce Labs), but it only does one thread per browser. I want one per class, which Surefire supports. Commented Jun 26, 2014 at 12:18
  • Hmm... okay. When it not work create a issue at the JUnit project. Ask for a solution of your problem. The people are very cooperative. github.com/junit-team/junit
    – Twaldigas
    Commented Jun 26, 2014 at 12:36

1 Answer 1

3

This scenario works with maven-surefire-plugin 2.16 or higher, JUnit 4.7 or higher. The Parameterized runner is a suite and therefore every single configuration means a new class. In your configuration of maven-surefire-plugin you should use parallel=classes and certain threadCount. You have many possibilities like classesAndMethods or threadCount + threadCountClasses, etc. Just see the plugin documentation http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.