小编Ren*_*ida的帖子

多模块Android项目中的全局代码覆盖:合并代码覆盖率报告(单元和UI测试)

我有一个Android应用程序,它由2个模块组成:

  • 应用 - 用户界面

  • 子模块 - 具有大部分业务逻辑

对于他们每个人,我都有一个gradle任务来验证代码覆盖率:

  • 应用程序:UI代码覆盖率(Espresso)

  • 子模块:单元测试代码覆盖率

作为客户端的要求,我需要合并这两个报告以获得应用程序的整体/全局代码覆盖率.

注意:我正在使用Gradle 3.1.2版.


App Gradle文件:

apply plugin: 'jacoco'

android {

   testBuildType "uiTest"

    ...

  buildTypes {
    debug {
        applicationIdSuffix ".debug"
        versionNameSuffix "-debug"
        debuggable true

        minifyEnabled false
        shrinkResources false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'


        matchingFallbacks = ['debug']
    }

    // TESTS

    // unitTest will be used to run unit tests.
    unitTest.initWith(buildTypes.debug) //Beware the buildType this depends on MUST be above on the gradle file
    unitTest {
        applicationIdSuffix ".unitTest"
        versionNameSuffix "-unitTest" …
Run Code Online (Sandbox Code Playgroud)

android jacoco android-espresso

14
推荐指数
1
解决办法
1661
查看次数

标签 统计

android ×1

android-espresso ×1

jacoco ×1