Exercises from the Lynda.com course for Unit Testing in Android Topics Covered: Local Unit Test, Hamcrest Library, Custom Rule, TestSuite and Test Categories, Instrumented Tests, Monkey Runner, UI Automator, Espresso, RoboElectric, Robotium and Mockito
- Type
git clone [email protected]:pfieffer/TestBedAndroid.git
orgit clone https://github.com/pfieffer/TestBedAndroid.git
to clone the repository. - Type
git pull
to pull all the branches - Open the project in Android Studio, do necessary syncing and building stuffs
- Switch between branches to view different files and see commit messages and comments for information.
- Run tests by right clicking a test class, method or suite and choosing Run or Use command line:
gradlew <TestClassName>
Branch with 02_XX are related to Local Tests. Branch with 03_XX are related to Instrumented Tests. Branch with 04_XX are related to Testing Tools. Branch with 05_XX are related to Mocking.
Have a look at this for differences between the two. Basically Local tests run on your computer's local JVM while the Instrumented tests require an android device to run. Thus Local tests are faster than Instrumented tests.