1
0
mirror of https://github.com/mik3y/usb-serial-for-android synced 2025-06-13 10:56:28 +00:00

Updated Device Tests & Coverage Report (markdown)

kai-morich 2021-03-25 21:44:54 +01:00
parent 806dda7277
commit 367c9ccdff

@ -53,10 +53,16 @@ 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 **device** *flavor* defined in ``coverage.gradle`` execute the corresponding gradle task ## Run unit tests
Disable ``testCoverageEnabled true`` and execute gradle task *usb-serial-for-android -> usbSerialForAndroid -> verification -> testAnyDeviceDebugTest*.
Note: with enabled ``testCoverageEnabled true`` the test fails or creates an empty __*.exec__ report file. You can check this by loading *usbSerialForAndroid/build/jacoco/testAnyDeviceDebugUnitTest.exec* with *Android Studio -> Run -> Show Code Coverage Data*.
## Run device tests
Enable ``testCoverageEnabled true`` and 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 -> verification -> create***Device***DebugCoverageReport* or
*usb-serial-for-android -> usbSerialForAndroid -> other -> create***Device***DebugAndroidTestCoverageReport*. *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. Both tasks create the required __*.ec__ report files but html reports do not contain annotated source code.
Test reports are created even if tests fail. Nevertheless you should check that it didn't fail completely. Test reports are created even if tests fail. Nevertheless you should check that it didn't fail completely.