Different Behaviour Jacoco Report Generation

19 views
Skip to first unread message

Thilaknath Ashokkumar

unread,
Aug 26, 2021, 1:30:11 PM8/26/21
to JaCoCo and EclEmma Users
Hello Team, 

We have been trying to containerize our build execution. We are using gradle as our build tool. When we execute the task 

./gradlew jacocoTestReport in our local machine we are getting the xml report with code coverage generated correctly. 

When we execute the same inside a linux docker container, We are seeing that the xmlreport generated does not contain the code coverage metrics.

On comparing the exec files within and outside the container, They are of the same size. I also tried copying the exec file from my local to the container and tried running the above task again, Still the xml report does not get generated with the required metrics. Can you help us trouble shoot this difference in behavior?


Thilaknath Ashok Kumar

Marc Hoffmann

unread,
Aug 26, 2021, 2:23:55 PM8/26/21
to JaCoCo and EclEmma Users
Hi Thilaknath,

Are you using the exact same class files at runtime and when generating the report? See FAQ:


Why does a class show as not covered although it has been executed?

First make sure execution data has been collected. For this select the Sessions link on the top right corner of the HTML report and check whether the class in question is listed. If it is listed but not linked the class at execution time is a different class file. Make sure you're using the exact same class file at runtime as for report generation. Note that some tools (e.g. EJB containers, mocking frameworks) might modify your class files at runtime. Please see the chapter about class ids for a detailed discussion. 

Best 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/4246690f-ff20-4b64-97d5-068a0db2a5a8n%40googlegroups.com.

Thilaknath Ashokkumar

unread,
Aug 26, 2021, 4:13:41 PM8/26/21
to JaCoCo and EclEmma Users
I am not sure about that, But one thing I am certain is. If I use the .exec file that was generated inside a container run and copy it to my machine and then run jacocoReport task the xml just generates fine. The vice versa doesn't work.

Marc Hoffmann

unread,
Aug 27, 2021, 4:18:44 AM8/27/21
to JaCoCo and EclEmma Users
If you create the HTML report you can check whether this is the case. See FAQ entry. Also the HTML report will show a hint at every class which has non-matching exec file data.

Thilaknath Ashokkumar

unread,
Aug 27, 2021, 12:50:43 PM8/27/21
to JaCoCo and EclEmma Users

Hello Team, 

I generated the exec file from my local and docker run and opened it up with intellij (Run -> Show code coverge data). On comparing the class ID's they are the same when comparing with both the executions. 
But something to note. 

Even with intellij (There is an option to generate) coverage report based on the exec file -> When doing this it returns empty coverage for both the exec files.

Thilaknath Ashokkumar

unread,
Aug 27, 2021, 4:53:48 PM8/27/21
to JaCoCo and EclEmma Users
Closing this issue, It was a small typo in jacoco report format which was causing this failure. 
Reply all
Reply to author
Forward
0 new messages