with Android Studio, Gradle, Espresso, Robolectric, AndroidAnnotations, RoboCoP, JaCoCo
Wishes, improvements and discussions about the stuff here are welcome
- A more minimalistic robolectric example can be found at https://github.com/nenick/AndroidStudioAndRobolectric
- Basic examples how to use gradle-android-test-plugin see https://github.com/novoda/gradle-android-test-plugin
- Android Studio 1.1.0
- Gradle Build Tools 1.1.2
- Gradle 2.2.1
- Novoda gradle-android-test-plugin 0.10.4 (Not yet released)
Until next novoda plugin release use the Script/install-custom-gradle-test-plugin.sh to install the necessary plugin version
clone, attach phone (or start emulator), run Scripts/run-tests.sh from project root
import to android studio, start development, press play
Out of the box
unit tests: ./gradlew :App:testDebug
- append
:App:jacocoTestReportfor coverage report
component tests: ./gradlew :AppComponentTests:testDebug
- append
:AppComponentTests:jacocoTestReportfor coverage report
acceptance tests: ./gradlew :App:connectedAndroidTest
- replace by
:App:connectedCheckfor coverage report
Currently RestActivity example fails when no server is reachable.
- start
Script/start-wiremock.sh - kill
Script/start-wiremock.sh kill
- build/index.html (should collect all reports, current is miss the AndroidSample module reports)
- App/build/test-report/debug/index.html (unit test)
- App/build/reports/jacoco/jacoco.html (unit test coverage)
- AppComponentTests/build/test-report/debug/index.html (component test)
- AppComponentTests/build/reports/jacoco/test/html/index.html (component test coverage)
- App/build/reports/androidTests/connected/index.html (acceptance tests)
- App/build/reports/coverage/debug/index.html (acceptance tests coverage)
- Gradle + AndroidStudio as development Enironment
- Robolectric for unit tests at jvm instead on devices
- Code coverage with JaCoCo
- novoda/gradle-android-test-plugin to use Robolectric in submodule
- Code coverage with JaCoCo
- FEST Android assertions
- Espresso for acceptance tests
- AndroidAnnotations generate dependency injection
- RoboCoP generate database management
- Travis CI runs all test variants
- Coveralls shows unit test code coverage coveralls-gradle-plugin
- run-tests.sh execute all test variants
- run-tests-fast.sh execute just the robolectric tests
- run-tests-travis.sh do all steps necessary for full automatic builds, like install custom dependencies
