Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a description how to speed up testing with parallel execution #7516

Merged
merged 4 commits into from
Sep 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions content/doc/developer/testing/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,36 @@ Most Java IDEs should be able to run JUnit tests and report on the results.
//==== From the Command Line
//==== From an IDE

=== Performance considerations

The test runner (Surefire) supports running tests in parallel to speed them up.
A possibility to configure this machine-wide is to adjust the `forkCount` within Maven.
The default setting is `forkCount=1`, which means no parallel testing.
An often-used setting is `1C`, which spawns as many testing processes in parallel as CPU cores are present.
If you have a machine with many cores, it might be faster to set it to a smaller number, like `0.45C`.
For example, with 16 cores the runner will be spawning up to 7 processes.
More details can be found in the link:https://maven.apache.org/surefire/maven-surefire-plugin/examples/fork-options-and-parallel-execution.html[Maven Surefire documentation].

You can also adjust this globally within a Maven profile setting, independently of the Plugin configuration.
The Maven profile can be typically found at: `~/.m2/settings.xml` (Linux) or `%userprofile%/.m2` (Windows).
A profile setting with the name "faster", which is enabled by default can look like this:

[source,xml]
----
<profile>
<id>faster</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<forkCount>0.45C</forkCount>
</properties>
</profile>
----

In the IDE this setting will be able to enable or disable depending on the test suite you are working on.
In case of problems it can also be deactivated on the command-line with `-P=-faster`.

== What to Test
Now that we can write a basic test, we should discuss what you should be testing…

Expand Down