有谁能给我推荐在命令行中运行Robotium测试套件的方法吗?
adb shell am instrument-w com.package/android.test.instrumentationtestrunner
这将运行该包中的所有测试用例,但在我的应用程序中,应按顺序执行其中的测试。有没有办法从命令行按顺序运行测试套件或单个测试用例?

最佳答案

按顺序运行测试

am instrument -w -e class_name#method name package-name/runner

例如
am instrument -w -e class com.example.test.class1#test1 com.example.test/android.test.InstrumentationTestRunner`

参考:http://developer.android.com/tools/testing/testing_otheride.html#RunTestsCommand
yy您可以尝试以这种方式运行多个测试,但更好的方法是创建一个测试套件,以确保按顺序执行(添加测试的顺序)
执行测试套件
adb shell am instrument -w -e class class_name package_name/runner

例如。
adb shell am instrument -w -e class com.example.test.class1 com.example.test/android.test.InstrumentationTestRunner

10-08 17:43