Execute tests on multiple devices in parallel within a single Gradle project


I am working on a project that contains a Junit integration test suite which executes a series of tests on a embedded hardware device. This testsuite is triggered via a Gradle task.

I would like to make the test suite run on multiple devices in parallel.

I tried out something similar to what this plugin on github was trying to accomplish but the Worker API seems to no longer allow to run tasks in arbitrary threads.

Is there a proper way to run multiple test tasks in parallel in Gradle v4.10?

Thank you!

1 Like

We’ve been able to solve our problem using subprojects.

Each target device is mapped to a subproject.

There is a default test task that is used to compile the unit tests:

test {

The subprojects depend on it:

subprojects {

    task integrationTest(type: Test) {
    classpath += rootProject.test.classpath
    testClassesDirs += rootProject.test.testClassesDirs

    compileTestJava.dependsOn tasks.getByPath(':testClasses')

Now it is possible to run the testsuite using gradle’s --parallel option.