Let's write some test cases. To write this code, we need to create new files in the androidTest package. To do this, follow the steps:
- Now go to src | androidTest | java | module_name of the project. Here is a screenshot of this directory:
- Create a class named MainActivityTest.kt with @RunWith(AndroidJUnit4::class) annotation. This annotation will link the test and the app features.
Let's create our very first Espresso test:
First of all, we need to connect our MainActivity class. To do this, we will initialize a variable of ActivityTestRule<MainActivity> and it will provide all the functionalities for the MainActivity ...