I have a android test project
setup to test my android project
. In the android test project
's manifest, I have an entry for instrumentation
. It looks like:
<instrumentation
android:name="android.test.InstrumentationTestRunner"
android:targetPackage="com.company.android" />
I'm curious what the point of this entry is, and particuarly what the purpose of android:targetPackage="com.company.android"
is for. I ask, because I refactored the old project and put classes into different packages, so I'm curious on what I need to update this value to... is it suppose to point the the package where the class that extends android.app.Application
is at?
The AndroidManifest. xml file contains information of your package, including components of the application such as activities, services, broadcast receivers, content providers etc.
The Android manifest file helps to declare the permissions that an app must have to access data from other apps. The Android manifest file also specifies the app's package name that helps the Android SDK while building the app.
For your New Relic-monitored Java application, one custom instrumentation method is to use an XML file that lists the methods and classes you want to instrument.
Structure of a Manifest file in Android is: The name of the application's package, it is generally the code's namespace. This information is used to determine the location of the code while building the project. Another component is the one, that includes all the activities, services, receivers, and content providers.
It tells the build system where to access the actual project you are going to test.
This is necessary because you need access to all your Activities and classes without having extra copies around.
Info about it is scattered around in: http://developer.android.com/tools/testing/testing_android.html
InstrumentationTestRunner is something you use to write Android unit tests.
From the documentation:
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With