【发布时间】:2020-10-29 18:18:40
【问题描述】:
我的项目结构如下:
模块应用
androidTest //Espresso tests covers classes from login and registration
main //Contains UI and business logic
test
模块登录
androidTest //No tests written
main //Contains UI and business logic
test //Only unit tests
模块注册
androidTest //No tests written
main //Contains UI and business logic
test
问题:我有上面类似的 android 项目结构并且能够生成 jacoco 代码覆盖率报告,它可用于声纳仪表板。我面临的问题是 espresso 测试仅显示模块应用程序的代码覆盖率,而不显示其他模块的代码覆盖率。 Espresso 测试针对注册等用例流程运行,然后登录并从其他两个模块调用类,但其他两个模块的覆盖率始终为 0%。
- 我想了解 espresso 是如何生成代码覆盖率的,它是否类似于单元测试,其中编写单元测试的包和类相同?
- 如何从 espresso 测试中编写的代码中逐行查看覆盖率?这些测试涵盖了整个项目 src 中的所有类。
- 我是否也应该在其他模块中编写 espresso 测试?不确定它是否会显示覆盖范围。
- 请针对 espresso 代码覆盖率提出任何缺失的配置。
【问题讨论】:
标签: android sonarqube code-coverage android-espresso android-instrumentation