JaCoCo remote using gradle

506 views
Skip to first unread message

Felix Gao

unread,
May 17, 2016, 6:37:30 PM5/17/16
to JaCoCo and EclEmma Users

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-0.7.6.201602180812.jar=append=false,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.runtimeCReloadlasspath  jacoco {
    address = 192.168.99.100
    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.


Thanks,

Felix

Marc R. Hoffmann

unread,
May 18, 2016, 2:16:22 AM5/18/16
to jac...@googlegroups.com
Hi Felix,

if you configure the agent in tcpserver output mode you also need a dump command to retrieve the data from the server (I can't see this in your script). In Ant or Maven it would be the dump goal. With Gradle I'm not familiar though. Maybe you check with the Gradle project how the dump command works there.

Regards,
-marc
--
You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/efca4e30-2038-4440-9614-dcb3d0b208bb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
Message has been deleted
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages