TA的每日心情 | 无聊 昨天 09:08 |
---|
签到天数: 531 天 连续签到: 1 天 [LV.9]测试副司令
|
1测试积点
本帖最后由 测试积点老人 于 2019-8-30 09:53 编辑
通过jacoco查看android中代码覆盖率,但是在报告中无法查看到源码执行情况
环境
jacoco + gradle
配置情况
- def coverageSourceDirs = [
- '../src/main/java'
- ]
- task jacocoTestReport(type: JacocoReport) {
- group = "Reporting"
- description = "Generate Jacoco coverage reports after running tests."
- reports {
- xml.enabled = true
- html.enabled = true
- }
- classDirectories = fileTree(
- dir: './build/default/intermediates/classes/debug',
- excludes: ['**/R*.class',
- '**/*$InjectAdapter.class',
- '**/*$ModuleAdapter.class',
- '**/*$ViewInjector*.class'
- ])
- sourceDirectories = files(coverageSourceDirs)
- executionData = files("$buildDir/outputs/code-coverage/connected/coverage.ec")
- doFirst {
- new File("$buildDir/intermediates/classes/").eachFileRecurse { file ->
- if (file.name.contains('
- )) {
- file.renameTo(file.path.replace('
- , '
- ))
- }
- }
- }
- }
复制代码 结果
只能查看到方法试图,无法再次进入,查看到方法中的源码
|
|