问题描述
- 我在
androidTest
目录下写了一些测试用例. - 我正在使用androidx(
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
) -
添加了依赖项:
- I have written some test cases under
androidTest
directory. - I am using androidx (
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
) added dependencies:
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test:rules:1.1.0'
也将JaCoCo添加为依赖项.
added JaCoCo as dependency, as well.
我猜测是由于此错误导致的:
I am guessing that is due to this error:
推荐答案
很有可能不需要androidx.test.runner.AndroidJUnitRunner
的自定义版本.
A custom version of the androidx.test.runner.AndroidJUnitRunner
is most likely not required.
但这是您定义为debugTree
的路径:
But this path here, which you've defined as the debugTree
:
"${project.buildDir}/intermediates/classes/debug"
同时可能是类似的东西:
Might meanwhile be something alike:
"${project.buildDir}/intermediates/javac/debug/compileDebugJavaWithJavac/classes"
例如:
build/intermediates/javac/debug/compileDebugJavaWithJavac/classes
build/intermediates/javac/release/compileReleaseJavaWithJavac/classes
如果找不到*.class
文件,则测试覆盖率将报告为0%
.
If it cannot find the *.class
files, the test-coverage will be reported as 0%
.
只需浏览build
目录以查看实际路径是什么.
Just browse the build
directory to see what the actual path is.
这篇关于JaCoCo的覆盖率显示为0%,即使所有测试都通过了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!