I am trying to execute each method of a JUnit test into a separated VM without executing all the methods at the same time. I want to serialize the execution of the test methods using a separated VM for each of them.
I have tried several configuration and checked the Maven plugin documentation about forked VM but I did not manage to get the correct behavior.
I am using the following configuration but all the methods are executed at the same time.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<reuseForks>false</reuseForks>
<parallel>methods</parallel>
<threadCountMethods>1</threadCountMethods>
</configuration>
</plugin>
The number of threads is counted by code by default (https://maven.apache.org/surefire/maven-failsafe-plugin/integration-test-mojo.html#perCoreThreadCount). The following configuration is working.
<configuration>
<reuseForks>false</reuseForks>
<parallel>methods</parallel>
<threadCount>1</threadCount>
<perCoreThreadCount>false</perCoreThreadCount>
</configuration>