无法找到仪器仪表目标包:com.xyz [英] Unable to find instrumentation target package: com.xyz

查看:190
本文介绍了无法找到仪器仪表目标包:com.xyz的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个测试用例类库项目,我创造了这个测试用例单独的项目。

I wrote a testcase class for a library project,I created this test case project separately.

当我试图运行这个测试project.the控制台显示错误无法找到仪器仪表目标包:其中,与包名称>

when I am trying to run this test project.the console is showing the error "Unable to find instrumentation target package: <with package name>",

我谷歌的解决方案还,在一些网站,他们给检查标签的android:targetPackage属性,AndroidManifestFile

I google for the solution also,in some sites they gave check the tag android:targetPackage attribute in AndroidManifestFile .

我检查清单中的仪器标签是正确的它的目标是正确的libraryproject包。

I checked the manifest the instrumentation tag is correct it is targeting correctly the libraryproject package.

可以在这个任何一个帮助,让我的测试用例项目库可运行

Could any one help in this,to make my testcase project for a library runnable

推荐答案

您必须创建和安装的应用程序项目依赖于库项目,以测试在图书馆计划。从官方开发人员指南:

You have to create and setup an Application Project that depends on the Library Project, in order to test the Library Project. Quoting from official developer's guide:

有设置在code和测试资源库中的项目推荐采用两种方式:

Testing a Library Project

There are two recommended ways of setting up testing on code and resources in a library project:

      
  • 您可以设置一个测试项目,仪器的应用程序项目   依赖于库项目。然后,您可以添加检测到   项目库的特定功能。

  • You can set up a test project that instruments an application project that depends on the library project. You can then add tests to the project for library-specific features.

您可以建立一个建立一个标准的应用程序项目依赖于库,把仪器在该项目。这使您可以创建包含测试/仪器仪表和code测试一个自包含的项目。

You can set up a set up a standard application project that depends on the library and put the instrumentation in that project. This lets you create a self-contained project that contains both the tests/instrumentations and the code to test.

Android的库项目没有直接内置,但随着主应用程序项目构建。换句话说,你不能直接编译它自身的apk和Android设备上运行它。另外,仪器仪表的测试工作,通过运行测试项目中的应用(运行方式... - >Android的JUnit测试在Eclipse)在设备上同时安装app.apk和test.apk后,再使用测试apk文件操纵app.apk,因此仪器测试名称的组成部分。

Android Library Projects are not built directly, but are built along with the Main Application Project. In another words, you cannot compile it directly to its own .apk and run it on an Android device. On the other hand, instrumentation tests work by running the test project application ("Run As..."->"Android JUnit Test" in Eclipse) after installing both app.apk and test.apk on the device, and then using test.apk to manipulate the app.apk—hence the "instrumentation" part of the test name.

更新:

请注意,如果使用第二种方法,你可以创建一个测试项目的测试库项目,而无需创建第三个应用项目,因为一个测试项目本身也是一个普通的应用程序项目。

Note that if you use second approach, you can create a Test Project testing Library Project without creating a third Application Project, because a Test Project itself is also a regular Application Project.

这篇关于无法找到仪器仪表目标包:com.xyz的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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