I am new to gradle. I am using the below code. But it generates coverage for unit test cases. But it didn\'t generate for integration test cases. I have my test classes in the p
Since I couldn't make it run with any of the answers, I will add my solution here.
It will work if you run your test task (e.g. integTest) first and call the jacocoTestReport afterwards.
All you need is to tell the jacocoTestReport task where to find the gathered execution data from you test task. The execution data is always named after the test task. So if you have a test task called integTest, your execution data will be stored in build/jacoco/integTest.exec. The jacocoTestReport task can be configured to look for those other files too by adding them to the property executionData. You can also add wildcards includes so all execution data is taken into consideration:
jacocoTestReport {
executionData = fileTree(dir: project.projectDir, includes: ["**/*.exec"])
}
by executing the statement below the test coverage jacoco report will be created for you integration test task (e.g. integTest)
./gradlew integTest jacocoTestReport
This also works for multi module projects where you want to run the integTest task in module a:
./gradlew a:integTest a:jacocoTestReport