Hi.
-Tx option will not change anything about how surefire works.
using this configuration (which is the default):
<forkCount>1</forkCount>
<reuseForks>true</reuseForks>
means surefire will create only one fork and reuse it BUT only for the
same maven module.
With -T2 you will have a maximum of 2 maven modules building in
parallel which means you can have potentially one surefire forked jvm
per module
which means a maximum of 3 jvms running at the same time.
On Wed, 22 Mar 2023 at 18:53, Debraj Manna <[email protected]> wrote:
>
> I have a multi-module project. My POM structure is like below
>
> root/pom.xml
>
> <modules>
> <!-- a,b,c & d are not dependent on each other. -->
> <module>a</module>
> <module>b</module>
> <module>c</module>
> <module>d</module>
> </modules>
>
> I am running surefire with reuseForks = true, forkCount = 1. If I am
> executing all tests at the root level with mvn -T 2 test. How will tests be
> executed?
>
> Assuming maven picks modules *a* and *b* to be executed first. Then module
> *a* and Module *b* tests will be executed in two separate JVM and once
> those are finished. There will be two new JVM spawned which will execute
> all tests for module c and module d.
>
> Is my above understanding correct or the same two JVMs will be reused for
> executing tests for module *c* and module *d?*
>
> I am using surefire 3.0.0-M7. My entire surefire config in root/pom.xml
> looks like below.
>
> <pluginManagement>
> <plugins>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-surefire-plugin</artifactId>
> <version>3.0.0-M7</version>
> <configuration>
> <systemPropertyVariables>
> <!-- System properties to be applied to all tests -->
> <grpc.enabled>false</grpc.enabled>
> <management.metrics.export.datadog.enabled>false
> </management.metrics.export.datadog.enabled>
> <spring.profiles.active>test</spring.profiles.active>
> <spring.zipkin.enabled>false</spring.zipkin.enabled>
>
> <spring.test.context.cache.maxSize>3</spring.test.context.cache.maxSize>
> <user.language>en</user.language>
> <user.region>US</user.region>
> <ut.forkNumber>$${surefire.forkNumber}</ut.forkNumber>
> </systemPropertyVariables>
> <!--These values are chosen experimentally-->
> <argLine>
> -Xms512m -Xmx3g -XX:MaxDirectMemorySize=512m
> -XX:MaxMetaspaceSize=768m
> -XX:+HeapDumpOnOutOfMemoryError @{argLine}
> <!-- https://github.com/RuedigerMoeller/fast-serialization#mvn
> -->
> --add-modules=jdk.incubator.foreign
> --add-opens=java.base/java.lang=ALL-UNNAMED
> --add-opens=java.base/java.math=ALL-UNNAMED
> --add-opens=java.base/java.util=ALL-UNNAMED
> --add-opens=java.base/java.util.concurrent=ALL-UNNAMED
> --add-opens=java.base/java.net=ALL-UNNAMED
> --add-opens=java.base/java.text=ALL-UNNAMED
> --add-opens=java.sql/java.sql=ALL-UNNAMED
> <!-- Needed only for TestingUtils.parseJsonToPojo -->
> --add-opens=java.base/java.time=ALL-UNNAMED
> <!-- For wiremock -->
>
> --add-opens=java.xml/com.sun.org.apache.xpath.internal.jaxp=ALL-UNNAMED
> </argLine>
>
> <!-- Runs test suite / classes in parallel-->
> <parallel>suitesAndClasses</parallel>
> <perCoreThreadCount>false</perCoreThreadCount>
>
> <!--Uncomment the two lines below if you want to redirect all
> mvn test results into files.-->
> <!--<redirectTestOutputToFile>true</redirectTestOutputToFile>-->
>
> <!--<reportsDirectory>${project.build.directory}/test-reports</reportsDirectory>-->
>
> <!-- Starts multiple JVMs and runs tests in parallel-->
> <forkCount>1</forkCount>
> <reuseForks>true</reuseForks>
> </configuration>
> </plugin>
> <plugin>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]