我正在尝试使用命令行运行 android 仪器 Junit 测试。我正在使用以下命令,它正在启动测试。
adb shell am instrument -w com.android.foo/android.test.InstrumentationTestRunner
我的 android 项目包有以下 java 源文件(按字母顺序)
com.android.foo
活动测试
联系人测试
启动测试
发送测试
当我使用上述命令运行测试时,测试首先开始执行 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
但它给了我一个错误可能是因为我没有在我的代码中使用 TestCase 类,而是我的 LaunchTest 和其他扩展了 ActivityInstrumentationTestCase2。
任何帮助表示赞赏。