Instrumentation
Instrumentation is instantiated by the system before any of the application code is run, thereby allowing monitoring of all the interactions between the system and the application.
As with many other Android application components, instrumentation implementations are described in the AndroidManifest.xml
under the tag <instrumentation>
. However, with the advent of Gradle, this has now been automated for us, and we can change the properties of the instrumentation in the app's build.gradle
file. The AndroidManifest
file for your tests will be automatically generated:
defaultConfig { testApplicationId 'com.blundell.tut.tests' testInstrumentationRunner "android.test.InstrumentationTestRunner" }
The values mentioned in the preceding code are also the defaults if you do not declare them, meaning that you don't have to have any of these parameters to start writing tests.
The testApplicationId
attribute defines the name of the package for your tests. As a default, it is your...