【问题标题】:Android run single espresso test from command lineAndroid 从命令行运行单一浓缩咖啡测试
【发布时间】:2019-10-28 11:26:44
【问题描述】:

有没有办法从命令行在 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)

【问题讨论】:

    标签: android adb android-espresso android-instrumentation android-debug


    【解决方案1】:

    您所缺少的只是测试方法名称,该名称附加了类名,后跟一个“#” 示例: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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-06-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多