jacoco is displaying the old result until jacoco.exec is deleted

26 views
Skip to first unread message

Balasubramaniyan K

unread,
Nov 22, 2021, 11:43:32 PM11/22/21
to JaCoCo and EclEmma Users
Hi,

I am seeing a strange behavior. 

When my code coverage has reached to 100% , I go and comment out certain test cases expecting that the code coverage should be 91%. 

But I see the coverage is 100%. However, if I delete the jacoco.exec and run the maven again, I get the desired result 91%.

Any help on why I see this behavior and is there a way to fix it? Though it is not related to any jacoco version, I use 0.8.7

Thanks,
Bala

Marc Hoffmann

unread,
Nov 23, 2021, 4:44:18 AM11/23/21
to JaCoCo and EclEmma Users
Hi Bala, by

default the JaCoCo agent appends new execution data to existing exec files. This effectively means it get merged with the status of previous runs.

So either delete the exec files, run mvn clean or configure JaCoCo with append=false. See documentation: https://www.jacoco.org/jacoco/trunk/doc/prepare-agent-mojo.html

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/62b3c606-b7a9-4d12-8a1f-a2ba44dca594n%40googlegroups.com.

Message has been deleted

Balasubramaniyan K

unread,
Nov 23, 2021, 6:07:31 AM11/23/21
to JaCoCo and EclEmma Users
Hi Marc,

Thanks. It worked once I added <append>false</append>

Thanks,
Bala
Reply all
Reply to author
Forward
0 new messages