Last active
February 5, 2020 23:35
-
-
Save tir38/1266cbf745f0077b0bbb8e54bf255f8f to your computer and use it in GitHub Desktop.
Android: Run instrumentation tests on a single class or single method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z "$1" ]; then | |
echo "Must specify module (e.g. app)" | |
exit 1 | |
fi | |
if [ -z "$2" ]; then | |
echo "Must specify build type, starting w/ capital letter (e.g. Debug, DebugFree, ReleasePaid)" | |
exit 1 | |
fi | |
if [ -z "$3" ]; then | |
echo "Must specify package/class/test/regex. Examples:" | |
echo "* fully qualified class: com.example.MytestClass" | |
echo "* fully qualified method: com.example.MytestClass#myTest" | |
echo "* wildcard on package: com.example.*" | |
echo "* wildcard on class: MytestClass*" | |
echo "* wildcard on method: methodname*" | |
echo "(note: does not support leading wildcard e.g. *TestClass)" | |
exit 1 | |
fi | |
echo =============== | |
echo Running $1:connected$2AndroidTest for: $3 | |
echo =============== | |
./gradlew $1:connected$2AndroidTest -Pandroid.testInstrumentationRunnerArguments.tests_regex=$3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment