Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
CircleCI’s parallelization: junit tests with Gradle
#!/usr/bin/env bash
testFiles=$(find ./{app}/src/test/java/{your}/{package}/{name} -name '*.java' | sort | awk "NR % ${CIRCLE_NODE_TOTAL} == ${CIRCLE_NODE_INDEX}")
./gradlew test -PtestFilter="$testFiles"
testOptions {
unitTests.all {
if (project.hasProperty("testFilter")) {
ArrayList props = project.getProperties().get("testFilter")
.replaceAll("./app/src/test/java/{your}/{package}/{name}/", "**/")
.replaceAll(".java", ".class")
for (String item : props) {
include item
- sh ./
parallel: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.