Hi All,
Has anyone done JUnit test execution in parallel mode in AEM Cloud? If yes, are any changes needed in Cloud Manager that we need to reach out to Adobe for?
I have tried updating junit-platform.properties under /src/test/resources but could not see any improvement in deployment time.
Please could someone advise.
Thanks,
Ram
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
I have tested this configuration in the Cloud Sandbox pipeline, and it has successfully reduced the build time.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<parallel>all</parallel> <!-- "methods" or "both" can also be used -->
<threadCount>3</threadCount> <!-- Number of threads for parallel test execution -->
<forkCount>3</forkCount> <!-- Number of JVM forks -->
<reuseForks>true</reuseForks> <!-- Reuse forked JVMs for tests -->
<useSystemClassLoader>false</useSystemClassLoader>
</configuration>
</plugin>
hi @rampai,
In one of the projects I worked on, we implemented a CI/CD pipeline where the code was built in both our Jenkins instances and AEM CM in parallel. The CM outcome was mandatory for successfully completing the pipeline.
When we introduced parallel execution for JUnit tests, the build processing time dramatically decreased. TBH We also made some adjustments to test classes that contributed to this improvement. However, we remained dependent on the CM result. To address this, we updated our pipeline to generate visible reports before receiving the CM outcome. This allowed developers to check for any violations or issues raised from the SonarQube reports sooner.
In conclusion, I highly recommend using JUnit parallel execution because, with the right settings, it significantly speeds up development times.
Thanks @giuseppebag ,
Please could you confirm what adjustments you had to make to test classes as part of this improvement.
Regards,
Ram
Views
Replies
Total Likes
I refactored test initialization so that heavyweight objects or resources (like database connections, file I/O, Context-Aware configs) are set up only once per test suite rather than before each test: I used class-level setup methods (for example, using JUnit’s @BeforeAll) to share common resources.
Where possible, I reused objects across multiple tests rather than instantiating them repeatedly.
Cached results or configurations that do not change between tests to cut down on repeated computation.
I have tested this configuration in the Cloud Sandbox pipeline, and it has successfully reduced the build time.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<parallel>all</parallel> <!-- "methods" or "both" can also be used -->
<threadCount>3</threadCount> <!-- Number of threads for parallel test execution -->
<forkCount>3</forkCount> <!-- Number of JVM forks -->
<reuseForks>true</reuseForks> <!-- Reuse forked JVMs for tests -->
<useSystemClassLoader>false</useSystemClassLoader>
</configuration>
</plugin>
Views
Replies
Total Likes
@rampai Did you find the suggestions helpful? Please let us know if you need more information. If a response worked, kindly mark it as correct for posterity; alternatively, if you found a solution yourself, we’d appreciate it if you could share it with the community. Thank you!
Views
Replies
Total Likes
Views
Likes
Replies