-2

I have a unit test class, and execute test with Spring JUnit4. All tests execute about 15 minutes, because test runs one by one. Here is my problem. This test we won to execute for continuing integration. After every commit we need to wait this 15 minutes, and this is not acceptable. How can we execute this test with more than one thread, or all tests execute in parallel?

e.g I mean,run all @Test method in parallel,not two different class in parallel. if i have 60 test methods in one class,execute this 60 methods simultaneously.

  • e.g I mean,run all @Test method in parallel,not two different class in parallel. if i have 60 test methods in one class,execute this 60 methods simultaneously. – Zhivko.Kostadinov Feb 29 '16 at 11:18

1 Answers1

0

Configure maven surefire plugin so it runs in parallel:

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.19.1</version>
    <configuration>
      <parallel>methods</parallel>
      <threadCount>10</threadCount>
    </configuration>
  </plugin>

See Maven Junit4 documentation or Fork options and parallel execution for details.

Zbynek Vyskovsky - kvr000
  • 18,186
  • 3
  • 35
  • 43