首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Android Manifest规范

Android Manifest规范
EN

Stack Overflow用户
提问于 2013-04-17 06:45:51
回答 2查看 10.6K关注 0票数 6

我有一个android test project设置来测试我的android project。在android test project的清单中,我有一个instrumentation条目。它看起来像这样:

代码语言:javascript
复制
<instrumentation
    android:name="android.test.InstrumentationTestRunner"
    android:targetPackage="com.company.android" />

我很好奇这篇文章的意义是什么,特别是android:targetPackage="com.company.android"的目的是什么。我之所以这样问,是因为我重构了旧项目并将类放入了不同的包中,所以我很好奇我需要将这个值更新为……它应该指向包中扩展android.app.Application的类所在的位置吗?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2013-04-17 06:48:17

它告诉构建系统从哪里访问您要测试的实际项目。

这是必要的,因为您需要访问所有的活动和类,而不需要额外的副本。

有关它的信息分散在以下位置:http://developer.android.com/tools/testing/testing_android.html

票数 7
EN

Stack Overflow用户

发布于 2013-04-17 06:49:56

InstrumentationTestRunner是你用来编写安卓单元测试的东西。

从文档中:

代码语言:javascript
复制
Typical Usage

Write TestCases that perform unit, functional, or performance tests against the classes in your package. 
Typically these are subclassed from:

ActivityInstrumentationTestCase2
ActivityUnitTestCase
AndroidTestCase
ApplicationTestCase
InstrumentationTestCase
ProviderTestCase
ServiceTestCase
SingleLaunchActivityTestCase

In an appropriate AndroidManifest.xml, define the this instrumentation with the appropriate android:targetPackage set.
Run the instrumentation using "adb shell am instrument -w", with no optional arguments, to run all tests (except performance tests).
Run the instrumentation using "adb shell am instrument -w", with the argument '-e func true' to run all functional tests. These are tests that derive from InstrumentationTestCase.
Run the instrumentation using "adb shell am instrument -w", with the argument '-e unit true' to run all unit tests. These are tests that do notderive from InstrumentationTestCase (and are not performance tests).
Run the instrumentation using "adb shell am instrument -w", with the argument '-e class' set to run an individual TestCase.
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16048492

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档