No development project is complete until it has been thoroughly and rigorously tested, and Android Studio incorporates JUnit testing directly into the workspace. As the name suggests, the framework allows the testing of individual units of code. These are often individual modules but can just as likely be a single class or method.
The Android Studio JUnit test framework provides for two distinct types of test. They are as follows:
- Local unit tests are used to test business logic in an isolated environment that is not dependent on Android components or other code, although it is possible to mock some dependencies. These tests run on the local Java virtual machine and are consequently considerably faster than testing on a hardware device or emulator.
- Instrumented tests are used when we want to test elements of the Android framework itself, such as how our UIs behave...