在具有特定顺序的类的包上使用android检测运行Junit测试

Akh*_*tta 6 junit android robotium

我正在尝试使用命令行运行android instrumentation Junit测试.我正在使用以下命令,它正在启动测试权限.

adb shell am instrument -w com.android.foo/android.test.InstrumentationTestRunner
Run Code Online (Sandbox Code Playgroud)

我的android项目包有以下java源文件(按字母顺序)

com.android.foo

ActivityTest

ContactsTest

LaunchTest

SendTest

当我使用上面提到的命令运行测试时,测试首先开始执行ActivityTest,依此类推.这不是我想要的,我希望它首先执行LaunchTest,然后是ContactTest,SendTest和ActivityTest.我试过用

adb shell am instrument -w -e class com.android.foo.LaunchTest,com.android.foo.ContactTest com.android.foo/android.test.InstrumentationTestRunner
Run Code Online (Sandbox Code Playgroud)

但它给我一个错误可能是因为我没有在我的代码中使用TestCase类,而是我的LaunchTest和其他人扩展了ActivityInstrumentationTestCase2.

任何帮助表示赞赏.

Akh*_*tta 6

我终于使用以下命令使其工作:

adb shell am instrument -e class com.android.foo.LaunchTest -w com.android.foo/android.test.InstrumentationTestRunner
Run Code Online (Sandbox Code Playgroud)