Does Gradle run multiple tests in parallel in the same process?

I tried sifting through Gradle on Github but the answer was not clear.

Say I have the following configuration:

tasks.withType(Test) {
    maxParallelForks = 8
}

And I have 2,000 tests to run. Does a single fork run multiple tests in parallel within its own process? Basically would a static variable need to be thread-safe when running tests.

You’ll have to set the forkEvery property to a value greater than zero to start using parallel forks. Each fork is a separate jvm so each will have its own copy of any static variables.

tasks.withType(Test) {
    maxParallelForks = 8
    forkEvery = 10 // each fork will execute a maximum of 10 test classes 
}
1 Like

Will a fork execute those 10 test classes in parallel or serially?

Each fork will run the tests serially