Short story: the maven-surefire-plugin has a configuration like
to run junit tests in 1 jvm with 4 threads. Does gradle have anything similar?
Long story: my junit tests clean a special db (not rdbms), write stuff to it, wait a bit for the db to do its job and finally read from the db to verify. Not more than 1 test can run with a db at any time. Running all the junit tests sequentially takes about 1 hour. So I think I’ll create 4 instances of that db, have 4 java locks, loop forever in the
@Before method to get any free db lock and release the lock in
@After. Because of using those locks, Gradle’s
maxParallelForks doesn’t work for me as tests run in different jvms.
How could I do it in Gradle?