即使gradle报告不是,Jacoco报告也为空。

时间:2018-08-27 22:28:22

标签: android android-gradle junit4 android-testing jacoco

我试图将jacoco用于codecov,但是我没有看到有关codecov的任何报告。我反而得到了

  

处理覆盖率报告时出错

     

最常见的问题:

     

文件路径无法解析。报表为空或不包含您的文件。报告已过期。

因此,我尝试在本地生成jacoco报告,但报告为空。因此,例如,当我运行./gradlew clean test时,生成的报告显示了我进行的一个单元测试,但是当我运行./gradlew jacocoTestReport时,/reports/jacoco/目录中生成的html报告为空。这两个报告的屏幕截图以及我的gradle文件都在下面,谢谢。

build.gradle(app)

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'jacoco-android'

android {
    lintOptions {
        abortOnError false
    }
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.sarpuner.journal"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }

        customDebug {
            debuggable true
        }
    }
    buildToolsVersion '27.0.3'
}

repositories {
    maven { url "https://dl.bintray.com/ijabz/maven" }
}

dependencies {
    androidTestImplementation 'com.android.support:support-annotations:27.1.1'
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation 'dev.dworks.libs:volleyplus:0.1.4'
    implementation 'com.google.code.gson:gson:2.8.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:rules:1.0.2'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'org.jsoup:jsoup:1.11.3'
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.1.1'
    implementation 'net.jthink:jaudiotagger:2.2.3'
    api 'com.google.guava:guava:26.0-android'
}

build.gradle(项目)

buildscript {
    ext.kotlin_version = '1.2.60'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.dicedmelon.gradle:jacoco-android:0.1.3'

    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

jacoco test report. gradle test report

0 个答案:

没有答案