jacoco 报告中无法查看代码
本帖最后由 测试积点老人 于 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('
, '
))
}
}
}
}结果
只能查看到方法试图,无法再次进入,查看到方法中的源码
配置问题吧 定一下 配置下源代码 配置上就能看见了
页:
[1]