In the preceding recipes, we learned how to run and write unit tests. In this recipe, we will learn how to run instrumentation tests. The integration tests are placed under the androidTest
directory in your Android project.
Since instrumentation tests require real devices or emulators to run on, ensure that you have one of either of these. We'll be using Android Studio 3.0 for our coding purposes. You can download the source code from https://gitlab.com/aanandshekharroy/Anko-examples and switch to the 5-instrumentation-tests
branch. We will also be using Espresso for writing instrumentation tests as it is the easiest software to use. Espresso is automatically included in your project when you create a new project.