Reputation: 21
I have a project which contains around 50 junit tests. Each test takes about 5-6 minutes to run since it tries to assert on some data which takes about that time to be available in redshift(the test look up the data in redshift). Now I am trying to run all them in parallel and expecting all test to be run in about 15-20 minutes max. I tried to use test.runWith(){maxParallelForks} option but the tests takes more than an hour. These tests are all independent. Is there an efficient way to parallelize them?
N.B This is a neighbor test not just junits. So I don't have the option to mock the results as results to be derived from the actual interactions between our neighbor systems.
Thanks
Here is what I am using:
tasks.withType(Test) {
maxParallelForks = 50
}
Our cut off is to have them running in 20-25 minutes max but it's taking more then an hour.
Upvotes: 2
Views: 2141
Reputation: 844
junit-platform.properties
in your test/resources
folder with the following data:junit.jupiter.execution.parallel.enabled=false
junit.jupiter.execution.parallel.config.strategy=fixed
junit.jupiter.execution.parallel.config.fixed.parallelism=4
I have a 4 cores (without hyper threading). You can also try the dynamic
option.
@Execution(ExecutionMode.CONCURRENT)
Here is a great article on the topic. Also one here.
I have also experimented with parallel test execution and hat the following conclusions:
Upvotes: 4