Jacoco Integration Test code coverage

(Felix Gao) #1

I have a multiple module setup, my integration test is located at project/module/main/func-test. When I run the integration test, all test is ran successfully, but the jacoco’s exec file does not contain any coverage data.

The remote server is running with the following java options

java -javaagent:/usr/local/lib/jacocoagent-,dumponexit=false,output=tcpserver,address=*,port=6300,includes=com..idea.*

The build.gradle file looks like the following

dependencies {
    compile project(':api')
    testCompile group: 'com.jayway.restassured', name: 'rest-assured', version:'2.4.0'
    testCompile group: 'com.jayway.restassured', name: 'json-schema-validator', version:'2.4.0'
    testCompile group: 'com.google.code.gson', name: 'gson', version:'2.3.1'
    testCompile group: 'com.squareup.retrofit', name: 'retrofit', version:'1.9.0'
    testCompile group: 'com.squareup.okhttp3', name: 'okhttp', version:'3.0.1'
    testCompile group: 'com.jakewharton.retrofit', name: 'retrofit1-okhttp3-client', version:'1.0.2'
    testCompile group: 'org.testng', name: 'testng', version:'6.9.6'

sourceSets {
    // all other source sets
    funcTest {
        java {
            srcDir 'func-test/java'
        resources {
            srcDir 'func-test/resources'

dependencies {
    // functional tests
    // Everything from compile and testCompile targets
    funcTestCompile configurations.compile
    funcTestCompile configurations.testCompile

task funcTest( type: Test, dependsOn: cleanTest ) {
  useTestNG {
    suites "func-test/testng.xml"
  jvmArgs '-XX:+HeapDumpOnOutOfMemoryError'
  testClassesDir = sourceSets.funcTest.output.classesDir
  println testClassesDir
  classpath = sourceSets.funcTest.runtimeClasspath
  jacoco {
    address =
    enabled = true
    append = false
    includes = ['com.idea.*']
    destinationFile = file("${project.buildDir}/jacoco/jacocoIntegTest.exec")
    classDumpFile = file("${project.buildDir}/jacoco/classpathdumps")

When the integration task starts the jacocoIntegTest.exec file is zero byte, when the test is done it is about 3kb, so I am assuming the network is not a problem.