BrainStone
(BrainStone)
September 6, 2017, 8:59am
1
Hello everyone. I’d like to run my tests in parallel if and only if gradle itself is also running parallel. However I’m not sure how I could find that out. Also how I can get the max number of runners ideally I’d like something like this:
test {
if(gradle.runsParallel) {
maxParallelForks = gradle.runners
}
forkEvery = 1
}
BrainStone
(BrainStone)
September 6, 2017, 11:17am
2
Someone on IRC showed me the solution:
test {
if(gradle.startParameter.isParallelProjectExecutionEnabled()) {
maxParallelForks = gradle.startParameter.maxWorkerCount
}
forkEvery = 1
}
st_oehme
(Stefan Oehme)
September 6, 2017, 4:30pm
3
BrainStone:
forkEvery = 1
This will fork a new test process for every single test case, making your tests very slow.
BrainStone
(BrainStone)
September 21, 2017, 11:24am
4
I’m aware that this will for for every test class. It is intended behavior, as I need a fresh JVM for quite a few classes.