Android的工作室导入现有的单元测试"无法找到仪器仪表信息" [英] Android Studio import existing unit tests "Unable to find instrumentation info"

查看:199
本文介绍了Android的工作室导入现有的单元测试"无法找到仪器仪表信息"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我想我们的Andr​​oid Studio和测试,在日食工作的项目。我得到的一切编译和应用程序将启动就好了,但我不能让我的单元测试和工作。我终于得到了他们加入我的应用程序li​​b文件夹作为依赖编译,但我不认为我的运行配置是正确的,因为每当我跑我的测试中,我得到这个错误

 安装<包名称>
设备的外壳命令:下午安装-r/数据/本地的/ tmp /<包名称>中
PKG:/数据/本地的/ tmp /<包名称>
成功


运行测试
试运行开始
试运行失败:无法找到仪器仪表信息:ComponentInfo {<包名称> /android.test.InstrumentationTestRunner}
空测试套件。
 

解决方案

如果您在定义一个testInstrumentationRunner你的 build.gradle 像这样的:

 安卓{
    defaultConfig {
        testInstrumentationRunnercom.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner
 

请确保在运行配置窗口中,你在你的Andr​​oid工作室/的IntelliJ运行配置使用完全相同的专用检测仪器亚军为您的测试。

So I'm trying our Android Studio and testing a project that worked in eclipse. I got everything compiling and the application will launch just fine, but I can't get my unit tests up and working. I eventually got them compiling by adding my applications lib folder as a dependency, but I don't think my run configuration is right because whenever I run my tests I get this error

Installing <packagename>
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/<packagename>"
pkg: /data/local/tmp/<packagename>
Success


Running tests
Test running started
Test running failed: Unable to find instrumentation info for: ComponentInfo{<packagename>/android.test.InstrumentationTestRunner}
Empty test suite.

解决方案

If you have a testInstrumentationRunner defined in your build.gradle such as this:

android {
    defaultConfig {
        testInstrumentationRunner "com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner"

make sure that in the run configuration window you use the exact same "Specific instrumentation runner" in your Android Studio / IntelliJ run configuration for your test.

这篇关于Android的工作室导入现有的单元测试&QUOT;无法找到仪器仪表信息&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆