mirror of
				https://github.com/mik3y/usb-serial-for-android
				synced 2025-10-31 02:17:23 +00:00 
			
		
		
		
	Updated Device Tests & Coverage Report (markdown)
							parent
							
								
									c5a9a8df34
								
							
						
					
					
						commit
						b6f108787c
					
				| @ -54,12 +54,11 @@ 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* | ||||||
| 
 | 
 | ||||||
| ## Run unit tests | ## 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 *usb-serial-for-android -> usbSerialForAndroid -> verification -> testAnyDeviceDebugUnitTest* | ||||||
| 
 | 
 | ||||||
| ## Run device tests | ## Run device tests | ||||||
| Enable ``testCoverageEnabled true`` and for each **device** *flavor* defined in ``coverage.gradle`` execute the corresponding gradle task   | 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__ and __*.xml__ report files but html reports do not contain annotated source code. | Both tasks create the required __*.ec__ and __*.xml__ report files but html reports do not contain annotated source code. | ||||||
| @ -68,13 +67,15 @@ Test reports are created even if tests fail. Nevertheless you should check that | |||||||
| 
 | 
 | ||||||
| ## Create coverage report | ## Create coverage report | ||||||
| 
 | 
 | ||||||
| Create summary __*.xml__ report with gradle task *usb-serial-for-android -> usbSerialForAndroid -> other -> jacocoTestReport*. This also creates a local __*.html__ report with annotated source code. | Create summary __*.xml__ report with gradle task *usb-serial-for-android -> usbSerialForAndroid -> other -> jacocoTestReport*. | ||||||
|  | 
 | ||||||
|  | This also creates a local __*.html__ report with annotated source code. | ||||||
| 
 | 
 | ||||||
| ## Upload coverage report | ## Upload coverage report | ||||||
| 
 | 
 | ||||||
| Upload coverage reports to [codecov.io](https://codecov.io/gh/mik3y/usb-serial-for-android) using the uploader program. On Windows execute in ``command prompt`` (cmd.exe), e.g. | Upload coverage reports to [codecov.io](https://codecov.io/gh/mik3y/usb-serial-for-android) using the uploader program. On Windows execute in ``command prompt`` (cmd.exe), e.g. | ||||||
| 
 | 
 | ||||||
|     cd c:\work\AndroidStudioProjects\usb-serial-for-android |     cd c:\work\AndroidStudioProjects\usb-serial-for-android | ||||||
|     ..\codecov.exe -t <codecov-token> -f usbSerialForAndroid/build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml |     ..\codecov.exe -t <codecov-token> | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user