Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JacocoTestReport Skipped

I have a gradle project which is configured with Jacoco for the code coverage.But I don't see any exec file generated while executing the jacocoTestReport task. For the reference, my unit tests are successfully executing,I have the index.html file which is generated after executing unit tests.

Below is my jacoco configuration from build.gradle file.

jacocoTestReport {

outputs.upToDateWhen { false }

group = "Reporting"

//classDirectories = fileTree(dir: "build/classes/test")

//additionalSourceDirs = files(srcRoot)
//sourceDirectories = files(srcRoot)
//executionData = files("${allTestResults}/jacoco/jacocoTest.exec")

reports {
    xml.enabled true
    csv.enabled false
    html.destination "${testResults}/coverage"
}
}

jacocoTestReport.dependsOn test

And below is the screenshot for the index.html

enter image description here

Under my task Test,there's some jacoco configurations,below is the snippet :

jacoco {
    append = false
    destinationFile = file("$testResults/jacoco/jacocoTest.exec")
    classDumpFile = file("$testResults/jacoco/classpathdumps")
}

Can anyone suggest me what I'm missing?

like image 435
Tanvi Garg Avatar asked Feb 13 '26 03:02

Tanvi Garg


1 Answers

I had a similar issue , exec file is not generated as well.

I found that the jacocoTestReport was simply "skipped".

It got fixed by adding :

test {
  useJUnitPlatform()
}

That's because I'm using Junit5 with spring boot 2.X

I'm adding this answers here , to help others who keep searching for hours without being able to find a direct answer for this issue just like myself ...

like image 149
M. Amer Avatar answered Feb 15 '26 18:02

M. Amer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!