jacococli report generation using a spring jar file generates code coverage report for all packages including maven dependencies

26 views
Skip to first unread message

Kishore Mohanavelu

unread,
Nov 24, 2020, 11:00:17 AM11/24/20
to JaCoCo and EclEmma Users

I have a jacoco agent that is attached to a webservice. I executed my automation test cases and extracted the jacoco-client.exec from the webservice using the ExecutionDataClient. Now I am trying to generate a jacoco report for the webservice using the jacoco-client.exec file.

I am using the below command to generate the report.
java -jar jacococli.jar report jacoco-client.exec --classfiles rest-service2-0.0.1-SNAPSHOT.jar --html report

The webservice code repo is present as a separate repo and it is not a part of the automation code repo. So I cannot provide the classfiles path directly in the above command. So instead i am providing the application jar.

The issue is, jacoco is generating the code coverage report for all the maven dependencies in the jar along with the original code. But I need the code coverage for the application code alone and not the dependencies code. I am entirely new to using jacoco and don't know how to proceed further. Can someone please help me with this please.

Screenshot 2020-11-24 at 8.29.20 PM.png

Marc Hoffmann

unread,
Nov 25, 2020, 3:35:31 AM11/25/20
to JaCoCo and EclEmma Users
Hi,

JaCoCo creates a report for all class files you provide to the report generator. JaCoCo has no idea which classes belong to your web service.

Probably the best approach would be to have another JAR from your build which only contains the classes from the web service without 3rd party dependencies.

If you cannot retrieve this from your build you could unzip the all-in JAR and extract the class files you are interested in.

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/a5b38573-b603-409d-a090-4731bed6e35an%40googlegroups.com.
<Screenshot 2020-11-24 at 8.29.20 PM.png>

Reply all
Reply to author
Forward
0 new messages