How can I use Surefire to run parameterized tests in parallel?



  • 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?



  • 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



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2