Hi All. I am trying to ensure that each of my test classes runs in a separate JVM, while also trying to understand relationship between forkEvery, maxParallelForks from java plugin and --parallel option
In my setup, there is always a single large test per test class (Single method with @Test annotation in a class). My current understanding is that if I configure such tests with:
forkEvery = 1 maxParallelForks = 4
That will mean that we start 4 gradle workers and run them in parallel, each worker in separate JVM. Then we send test classes to them one by one. Every time one worker finishes with its test class, it is restarted in a new JVM process before running next test class.
But what if we also pass --parallel flag. How does this affect test runs?
From the documentation: https://guides.gradle.org/performance/
By using the --parallel switch, you can force Gradle to execute tasks in parallel as long as those tasks are in different projects
I have a multiproject setup. But I am already saying that tests should be run in parallel and I am constraining test runs, only 4 test classes can execute in parallel and each in separate JVM because of Java Plugin configuration above.
So what does --parallel flag change here? I thought it may have no effect but without --parallel switch, my tests run slower. Is it OK to use --parallel switch even though I want to make sure that each test class runs in a separate JVM?