Project structure:
src/main/java src/main/resources src/test/java
Gradle version : 2.2.1
Here is my build.gradle
apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'jacoco' version = '1.0' sourceCompatibility = 1.7 targetCompatibility = 1.7 test { include 'src/test/java' finalizedBy jacocoTestReport } jacoco { toolVersion = "0.7.6.201602180812" } 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" } }
when I run gradle task as “test jacocoTestReport”, I am getting the below results
:compileJava UP-TO-DATE :processResources UP-TO-DATE :classes UP-TO-DATE :compileTestJava UP-TO-DATE :processTestResources UP-TO-DATE :testClasses UP-TO-DATE :test UP-TO-DATE :jacocoTestReport SKIPPED
can someone please suggest what should be added to execute jacoco test report.
Thanks.
Advertisement
Answer
I was able to generate the code coverage results with the following set up.
apply plugin: 'jacoco' jacocoTestReport { reports { xml.enabled false csv.enabled false html.destination "${buildDir}/jacocoHtml" } }