Android清单检测
我有一个Android清单检测,android,android-manifest,android-testing,Android,Android Manifest,Android Testing,我有一个android测试项目设置来测试我的android项目。在android测试项目的清单中,我有一个instrumentation条目。它看起来像: <instrumentation android:name="android.test.InstrumentationTestRunner" android:targetPackage="com.company.android" /> 我很好奇这个条目的意义是什么,尤其是android:targetPacka
android测试项目
设置来测试我的android项目
。在android测试项目
的清单中,我有一个instrumentation
条目。它看起来像:
<instrumentation
android:name="android.test.InstrumentationTestRunner"
android:targetPackage="com.company.android" />
我很好奇这个条目的意义是什么,尤其是
android:targetPackage=“com.company.android”
的目的是什么。我问,因为我重构了旧项目并将类放入不同的包中,所以我很好奇我需要什么来更新这个值。。。假设它指向扩展了android.app.Application的类所在的包吗?它告诉构建系统在哪里访问要测试的实际项目
这是必要的,因为您需要访问所有活动和类,而不需要额外的副本
关于它的信息分散在:是您用来编写Android单元测试的东西
从文件中:
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.
它应该指向哪个包?活动在哪里,或者应用程序在哪里?p、 美国人喜欢手柄。通常活动的位置和应用程序的位置都是一样的。在我的应用程序中,它们与我的测试应用程序相同。我想它想知道应用程序包,因为它至少需要在查找活动之前访问应用程序。编译。。。我们看看是不是真的:)太好了!让我过去了。。。仍然有问题,但这给了我我需要的!