How do I merge reports

62 views
Skip to first unread message

Andrew Iyer

unread,
Jul 22, 2017, 1:20:05 PM7/22/17
to JaCoCo and EclEmma Users

I have four applications that run using the same codebase.

I have instrumented all of them successfully.

The problem is that Application A uses half of the codebase of package X, and Application B uses the *other* half of package X.

So, for example, one Application will call the "initialize" function, the other application will be sent this, say, and then call the "toString" function to save it to a db.

When I look at my jacoco report, given this pattern of usage, I see only an average of 20% coverage, whereas I suspect the *actual* coverage is closer to 60%.

I'm using (pretty much, the code sample isn't complete but you get the idea) the same code from here:
https://stackoverflow.com/a/31250878/1061426

thanks

Evgeny Mandrikov

unread,
Jul 23, 2017, 7:31:12 AM7/23/17
to JaCoCo and EclEmma Users
Please read the documentation http://www.jacoco.org/jacoco/trunk/doc/
There is "Merge" Ant Task ( http://www.jacoco.org/jacoco/trunk/doc/ant.html ), "Merge" Maven Goal ( http://www.jacoco.org/jacoco/trunk/doc/merge-mojo.html ) and not yet released "Merge" command in command line interface ( http://www.jacoco.org/jacoco/trunk/doc/cli.html ).
All code of their implementation is available - https://github.com/jacoco/jacoco
Please note that execution data is merged only for the same classes ( http://www.jacoco.org/jacoco/trunk/doc/classids.html ), i.e. common classes used by your Application A and by Application B should be the same and exact same classes should be used during creation of a report.

Andrew Iyer

unread,
Aug 2, 2017, 4:49:29 AM8/2/17
to JaCoCo and EclEmma Users
Thanks for this - so aside from the git repo, there isn't any documentation for using java code to generate merged reports?

I've never been very good with maven, and I couldn't really see how to take *already existing* exec files and merge them in maven, all I saw was how to generate and then merge the files, which isn't what I want to do.

Evgeny Mandrikov

unread,
Aug 11, 2017, 5:03:04 PM8/11/17
to JaCoCo and EclEmma Users
On Wednesday, August 2, 2017 at 10:49:29 AM UTC+2, Andrew Iyer wrote:
Thanks for this - so aside from the git repo, there isn't any documentation for using java code to generate merged reports?

As was said earlier - there are plenty docs at http://www.jacoco.org/jacoco/trunk/doc/ , please read them.

Among others there are JavaDoc for all APIs - http://www.jacoco.org/jacoco/trunk/doc/api/index.html
 
I've never been very good with maven, and I couldn't really see how to take *already existing* exec files and merge them in maven, all I saw was how to generate and then merge the files, which isn't what I want to do.

Again as was said earlier - there is "Merge" Maven Goal ( http://www.jacoco.org/jacoco/trunk/doc/merge-mojo.html ) that allows to merge *already existing* exec files.
And there is "Merge" Ant Task ( http://www.jacoco.org/jacoco/trunk/doc/ant.html ) and not yet released "Merge" command in command line interface ( http://www.jacoco.org/jacoco/trunk/doc/cli.html ). 
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages