2016-03-28 29 views
0

Testler başarısız olursa Jacoco kod kapsamı raporu oluşturulamaz.Graco ile jacoco kullanma

Aşağıda benim gradle dosyasının ilgili bölümdür:

task unitTest(type: Test) { 
    forkEvery = 1 
    jvmArgs = ['-Djava.net.preferIPv4Stack=true'] 
    testClassesDir = sourceSets.unitTest.output.classesDir 
    classpath = sourceSets.unitTest.runtimeClasspath 
    exclude '**/**TestBase.*' 
    outputs.upToDateWhen { false } 
    ignoreFailures = true 
    finalizedBy jacocoTestReport 
} 

task functionalTest(type: Test) { 
    forkEvery = 1 
    jvmArgs = ['-Djava.net.preferIPv4Stack=true'] 
    testClassesDir = sourceSets.functionalTest.output.classesDir 
    classpath = sourceSets.functionalTest.runtimeClasspath 
    exclude '**/**TestBase.*' 
    outputs.upToDateWhen { false } 
} 


jacocoTestReport { 
    group = "Reporting" 
    description = "Generate Jacoco coverage reports after running tests." 

    additionalSourceDirs = files(sourceSets.main.allJava.srcDirs) 
    reports { 
     xml.enabled false 
     csv.enabled false 
     html.destination "${buildDir}/reports/jacoco/html" 
    } 
    executionData = files('build/jacoco/test.exec') 
} 

ben "= true ignoreFailures" belirtmiş olsa da, test çalışmasından sonra hiçbir kod kapsamı raporu vardır.

There were failing tests. See the report at: file:///unitTest/index.html 
:MYModule:jacocoTestReport SKIPPED 

BUILD SUCCESSFUL 

Total time: 41 mins 34.018 secs 

cevap

1

Sorun, executionData'nın yanlış bir "test.exec" e işaret ettiğiydi. Yürütülmekte olan test görevinden sonra "unitTest.exec" olmalıdır.