Testing and debugging
The below is just a summary of what’s on the Android developer site
There are two types of tests in Android:
- Local unit tests
- Instrumented tests
Local unit tests
These tests are small and do not depend on the Android framework, or they use a modified version of the android.jar file. These run on the Java Virtual Machine (JVM) and are located in the src/test/java
folder. To write a typical local unit test for an Android project you will require JUnit, and to mock Android framework dependencies, you will need Mockito.
Instrumented tests
These tests run on actual devices and emulators and are located in the src/androidTest/java
folder. The instrumented tests have access to the Instrumentation API's
, the Android Context
and other information. Instrumented tests are typically used when writing integration and functional UI tests to automate user interaction