docs/TEST.md
Loop Habit Tracker has a fairly large number of automated tests to reduce the chance of bugs being silently introduced in our code base. The tests are divided into three categories:
Unit tests can be launched by running ./gradlew test or by right-clicking a particular class/method in Android Studio and selecting "Run testMethod()" or "Run ClassTest". An alternative way is to use build.sh, the script used by our continuous integration server. By running ./build.sh build, the script will automatically build and run all small tests.
To run medium tests, it is recommended to use the build.sh script.
./build.sh android-setup API to create the emulator, where API is the desired API level../build.sh android-tests API to run the tests on a single API../build.sh android-tests-parallel API API... to run the tests on multiple APIs in parallel.Note that instrumented tests are designed to run on a clean install, inside an emulator. They will not work on actual devices. All tests are also designed for a particular screen size, namely the Nexus 4 configuration (4.7" 768x1280 xhdpi), and a particular locale, namely English (US). Furthermore:
If there are failing view tests (that is, if some custom views do not render exactly like the prerendered images we have), then both the actual and expected images will be automatically downloaded from the device to the folder uhabits-android/build/outputs. After verifying the differences, if you feel that the actual images are actually fine and should replace the prerendered ones, then run ./build.sh android-accept-images.