Instantly share code, notes, and snippets.

Embed
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")
.split("\\s+")
for (String item : props) {
include item
}
}
}
}
test:
override:
- sh ./balancing.sh:
parallel: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment