It is frustrating that looking for a gradle command is so so so hard.
Anyway, finally I found the commands.
To run single a instrument test class:
./gradlew -Pandroid.testInstrumentationRunnerArguments.class=com.example.TestClass connectedDebugAndroidTest
To run a single instrument test method:
./gradlew -Pandroid.testInstrumentationRunnerArguments.class=com.example.TestClass#testMethod connectedDebugAndroidTest
To run multiple single instrument test methods:
./gradlew -Pandroid.testInstrumentationRunnerArguments.class=com.example.TestClass#testMethod1,testMethod2 connectedDebugAndroidTest
While we use Jenkins to run the tests, commands may be:
case_exec_cmd="bash ./gradlew connectedDebugAndroid"
But when we want to config:
[SomeTest]
test_A=Y
test_B=S
We can add one more file parseConfig.sh
:
if (config.contains.condition1) {
gradle_command = command1
} else if (config.contains.condition2) {
gradle_command = command2
}
Then in JenkinsRun.sh
:
case_exec_cmd = gradle_command
Reference: here.
网友评论