android - 测试运行开始测试运行失败 : Unable to find instrumentation info for: ComponentInfo{ro. vst.test/android.test.InstrumentationTestRunner}

标签 android testing

这是我的 full code ,当我运行以下代码时,

public class KernelTest {
    @Test
    public void testM() {
        assertEquals(1, 1);
    }
}

它提高了:

Test running failed: Unable to find instrumentation info for: ComponentInfo{ro.vst.test/android.test.InstrumentationTestRunner}

最佳答案

我找到了解决方法:在android studio 1.5中,无论我是否指定runner,avd端都会生成一个名为“my_pkg_name.test/runner_name”的包名,解决步骤为:

  • 运行一次安卓测试
  • 我得到“测试运行失败:无法找到检测信息:ComponentInfo{ro.vst.test/android.test.InstrumentationTestRunner}”
  • 运行adb shell pm list instrumentation,找到pkg相关工具
  • 我得到“instrumentation:ro.vst.test/com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner
  • 这两个 TestRunner 不同,所以我在 build.gradle 中指定 TestRunner,如下所示

构建.gradle

defaultConfig {
    testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
}
  • 现在再次运行,应该可以了

关于android - 测试运行开始测试运行失败 : Unable to find instrumentation info for: ComponentInfo{ro. vst.test/android.test.InstrumentationTestRunner},我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34567366/

相关文章:

api - 使用自定义处理程序测试 API 端点时无法访问 mux 参数

javascript - 如何使用 Enzyme 在 React 组件的数据属性中声明一个 div?

javascript - React Native - 如何永久禁止用户

android - 使用Android导航 Controller 并完成调用 Activity

testing - 当 ATReporter 未对失败的测试进行截图时,如何更改浏览器页面

unit-testing - TDD:单元测试重点

unit-testing - 在包下运行 go 测试时,如何在测试和覆盖率报告中跳过 go 文件

java - 如果文件存在于目录中,我如何覆盖它

android - 如何在 android 中使用 statuses/update_with_media 将图像发布到 Twitter

android - 调用 `setRequestedOrientation`后查找设备方向变化的方法