美文网首页Android
Gradlew run single instrument te

Gradlew run single instrument te

作者: JaedenKil | 来源:发表于2017-12-18 15:54 被阅读7次

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.

相关文章

网友评论

    本文标题:Gradlew run single instrument te

    本文链接:https://www.haomeiwen.com/subject/byraixtx.html