Run parallel test task using gradle
build.gradle, gradle, junit
Solution
`$rootDir/build.gradle`:
subprojects {
tasks.withType(Test) {
maxParallelForks = Runtime.runtime.availableProcessors()
}
}
Problem
We use JUnit as a test framework. We have many projects. We use gradle (version 1.12) as a build tool. To run the unit tests in parallel using gradle we use the below script in every project under test task. ``` maxParallelForks = Runtime.runtime.availableProcessors() ``` Ex: ``` test { maxParallelForks = Runtime.runtime.availableProcessors() } ``` We also maintain the single gradle.properties file. Is it possible to define test.maxParallelForks = Runtime.runtime.availableProcessors() in gradle.properties file rather than defining it in each build.gradle file under test task?