I have got two types of tests in my app as follows:
- Unit tests (large number of tests and quick to execute)
- Integration tests (small number of tests but each suite takes considerable time)
My project uses gradle and I want both sets of tests to execute concurrently. As per gradle's documentation, I can use maxParallelForks
config to parallelize the execution. However, as gradle distributes tasks to workers statistically (see here) there is a chance that all my integration tests get allocated to the same worker.
So, what I really want is to have two sets of test
blocks in my gradle file, e.g.:
test {
include 'org/unit/**'
exclude 'org/integration/**'
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
}
test {
include 'org/integration/**'
exclude 'org/unit/**'
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
}
Does gradle support two different test profiles like the above? If yes, can I execute those two in parallel?