Reputation: 1459
So here is the gist...
I use docker-compose
. My app is just a collection of REST services (spring boot w/ embedded tomcat) so basically I stick to testing endpoints. Whenever I wish to build project with tests (which are in a whole separate module) I use gradle and gradle docker-compose plugin. What happens is that during full build after compilation, docker-compose gradle plugin fires up all services, waits until app container is up and healthy and just executes a bunch of http requests (tests).
So my idea is - during full CI build, launch app in docker container with jacoco agent, that would generate coverage data when all the http tests are executed. But the file output always stays empty.
I add following to JAVA_OPTS
to app container
-javaagent:\jacoco\jacocoagent.jar=destfile=\tmp\jacoco.exec,includes=my.company.*,append=true,dumponexit=false
And the \tmp\jacoco.exec
is created but its stays at 0 bytes.
Jacoco version I use is 0.7.9
. Am I doing something wrong or don't I understand what jacoco agent is all about?
Upvotes: 1
Views: 2544
Reputation: 10564
dumponexit=false
together with destfile=...
means that file will not be written on VM shutdown (http://www.jacoco.org/jacoco/trunk/doc/agent.html), but only on API request (http://www.jacoco.org/jacoco/trunk/doc/api/org/jacoco/agent/rt/IAgent.html#dump(boolean)), which is not your intention, I guess. So set dumponexit
to true
, or don't specify it at all since true
is a default.
Upvotes: 1