是否可以通过命令行在Android的UI测试类中运行单个测试
//I can run all the tests with this command
$ adb shell am instrument -w -e class com.me.app.tests.Food.EatingTests com.me.app.dev.test/androidx.test.runner.AndroidJUnitRunner
// this is my test class
@RunWith(AndroidJUnit4.class)
public class EatingTests {
@Before
public void setup() throws Exception {}
}
@Test
@Priority1
public void eatApple() throws Exception {}
@Test
@Priority1
public void eatBanana() throws Exception {}
}
是否有一种方法只能运行eatApple()而不是使用所有测试(eatApple和eatBanana)运行整个类
答案 0 :(得分:0)
您所缺少的只是测试方法名称,该方法名称后面附加了类名和“#”
示例:adb shell am instrument -w -e class com.me.app.tests.Food.EatingTests#test_method_name com.me.app.dev.test/androidx.test.runner.AndroidJUnitRunner