This outreachy week blog is about the topic "Everyone struggles". Struggling sucks. No question. Sure, we know it's an inherent part of life, and even helpful for growth. People often struggle when they’re learning a new skill, which can feel excruciating. But it’s something to celebrate as it improves us day by day.
The time I struggled with a vocabulary term that confused me during the Outreachy application process was the difference between the android test and the test in android.
Local unit tests (/src/test/java/)
Unit tests that run locally on the Java Virtual Machine (JVM). Use these tests to minimize execution time when your tests have no Android framework dependencies or when you can mock the Android framework dependencies. The test directory should contain the tests that run on your local machine, such as unit tests. Unit tests are used to verify that business logic is working right without using a real device. We will use JUnit, hamcrest, and mockito-kotlin to achieve this.
Instrumented tests (/src/androidTest/java/)
Unit tests run on an Android device or emulator. These tests have access to instrumentation information, such as the Context of the app you are testing. Use these tests when your tests have Android dependencies that mock objects cannot satisfy. The android test directory should contain the tests that run on real or virtual devices. Such tests include integration tests, end-to-end tests, and other tests where the JVM alone cannot validate your app's functionality.
With instrumented testing, we are able to verify app logic that needs a real device, so mostly we will verify the UI. We will also use JUnit and we will add Espresso.