Recently got a new job, I'm working on a Maven and Micronaut project - I'm new to Micronaut, and if you're not familiar, its an alternative to Spring.
Using this as a guide: https://www.baeldung.com/maven-junit-parallel-tests
I'm trying to get our integration tests to run in parallel, in an attempt to speed up our tests. I have added the required configuration to the pom.xml file. I have tweaked this lots, with different combinations of settings (including ones I found on other SO posts).
But when I run the tests, with and without this added config, the time it takes to run them is exactly the same - 1 minute and 38 seconds. So I don't think its working. Although don't know what my expected output on the console should look like if it is working?
In the tests, none of them are using @RunWith, its using the default, which should be okay.
This is the pom. Can anyone advise please? Thanks.
<profiles>
<profile>
<id>integration</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludedGroups>unit, performance</excludedGroups>
<parallel>classes</parallel>
<threadCount>10</threadCount>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>performance</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludedGroups>unit, integration</excludedGroups>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>all</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludedGroups>none</excludedGroups>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<build>
<plugins>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<excludedGroups>integration, performance</excludedGroups>
<parallel>classes</parallel>
<threadCount>10</threadCount>
</configuration>
</plugin>
...
</plugins>
</build>
I had the same problem and tried every combination of:
maven-surefire-plugin (version 2.22.0)
maven-failsafe-plugin (version 2.22.0)
The parallel/threadCount configuration you mention.
These different plugin configurations specified at https://junit.org/junit5/docs/current/user-guide/#running-tests-build-maven-config-params and https://junit.org/junit5/docs/current/user-guide/#writing-tests-parallel-execution. As in this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.0</version>
<configuration>
<properties>
<configurationParameters>
junit.jupiter.execution.parallel.enabled=true
junit.jupiter.execution.parallel.mode.default=same_thread
junit.jupiter.execution.parallel.mode.classes.default=concurrent
</configurationParameters>
</properties>
</configuration>
</plugin>
The only combination that worked was 2 (maven-failsafe-plugin) and 4 (configurationParameters).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With