-
Notifications
You must be signed in to change notification settings - Fork 4
Android Testing
In order to properly test, there are a number of tools that we should be familiar with.
All the tools listed use JUnit.
Robolectric is used to mock out Android, allowing you to run unit tests off of JVM.
Robolectric tests are written in JUnit4
Robotium allows you to simulate actions. It's mainly used for UI and integration testing.
Good link:http://www.vogella.com/tutorials/Robotium/article.html
- filenames should follow
*Test.javaformat so the tests can be executed automatically
- filenames should follow
*IT.javaformat so the tests can be executed automatically
Run unit tests on JVM
-
Linux:
./gradlew test -
Windows:
gradlew.bat test
Run unit tests with code coverage report.
-
Linux:
./gradlew jacocoTestReport -
Windows:
gradlew.bat jacocoTestReport
To run integration tests, first make sure an android device is available for the tests to be run on. Whether that's an emulated or connected device is up to you. After that, run:
-
Linux:
./gradlew connectedAndroidTest -
Windows:
gradlew.bat connectedAndroidTest
Note: If you want more information on which specific tests passed/failed, use --info.
The Jenkins server is located at: 10.81.30.17:8080, and can only be accessed at the university. If you need to access it from elsewhere, you can do so through the University VPN.