1
0
mirror of https://github.com/mik3y/usb-serial-for-android synced 2025-06-08 16:36:10 +00:00

Updated Device Tests & Coverage Report (markdown)

kai-morich 2020-10-12 21:11:35 +02:00
parent f878b98065
commit 39fffdfeda

@ -53,11 +53,20 @@ Enable ``apply from: 'coverage.gradle'`` in ``usbSerialForAndroid/build.gradle``
Remove previous test results with ``gradle clean`` or *Android Studio : Menu -> Build -> Clean Project* Remove previous test results with ``gradle clean`` or *Android Studio : Menu -> Build -> Clean Project*
For each *flavor* defined in ``coverage.gradle`` execute the corresponding *create***Flavor***DebugAndroidTestCoverageReport* task. You can find these tasks in Android Studios Gradle window in the *usb-serial-for-android -> usbSerialForAndroid -> other* folder. You can show this window with *Android Studio : Menu -> View -> Tool Windows -> Gradle*. For each **device** *flavor* defined in ``coverage.gradle`` execute the corresponding gradle task
*usb-serial-for-android -> usbSerialForAndroid -> verification -> create***Device***DebugCoverageReport* or
*usb-serial-for-android -> usbSerialForAndroid -> other -> create***Device***DebugAndroidTestCoverageReport*.
Both tasks create the required *.ec report files but html reports do not contain annotated source code.
As tests can be flaky, it's best to first execute *DeviceTest* as this shows the test results and errors much better and on success execute the *create***Flavor***DebugAndroidTestCoverage* task. Test reports are created even if tests fail. Nevertheless you should check that it didn't fail completely.
Upload coverage reports to [codecov.io](https://codecov.io/gh/mik3y/usb-serial-for-android) using the bash uploader. On Windows execute in ``Git Bash``. I tried to merge the test reports locally, but the recommended *jacocoTestReport* task for whatever reason did nothing. ## Local coverage report
With gradle task *usb-serial-for-android -> usbSerialForAndroid -> other -> jacocoTestReport* you can create a summary report that also includes annotated source code.
## Upload coverage report
Upload coverage reports to [codecov.io](https://codecov.io/gh/mik3y/usb-serial-for-android) using the bash uploader. On Windows execute in ``Git Bash``