jacococli measures coverage for tests, but not the code covered.

30 views
Skip to first unread message

a.gor...@gmail.com

unread,
Jan 30, 2019, 8:03:12 PM1/30/19
to JaCoCo and EclEmma Users
Hello Jacococers,

I'm trying to measure a code coverage on some project. It has its own build infrastructure and doesn't use maven/ant. When I run unit tests I pass all required arguments: "-javaagent:~/jacoco/lib/jacocoagent.jar=destfile=/tmp/jacoco_test/coverage.exec". Everything looks fine and runs without any errors. But when I convert coverage.exec to html report it shows 0% coverage. What's is the most curious thing, when I run "java -jar ~/tmp/java_coverage/jacoco/lib/jacococli.jar execinfo /tmp/jacoco_test/coverage.exec", I see there only test-related classes, while I expected to see test-covered (classes implementing business logic itself or classes under tests) classes as well. I understand that my guess might be wrong. So could you please clarify that I should see test-covered classes in the execinfo output as well? I'm absolutely puzzled, any help appreciated.

Great thank you in advance!

Message has been deleted
Message has been deleted

Evgeny Mandrikov

unread,
Jan 31, 2019, 6:36:11 AM1/31/19
to JaCoCo and EclEmma Users
Hi,


On Thursday, January 31, 2019 at 2:03:12 AM UTC+1, a.gor...@gmail.com wrote:
Hello Jacococers,

I'm trying to measure a code coverage on some project. It has its own build infrastructure and doesn't use maven/ant. When I run unit tests I pass all required arguments: "-javaagent:~/jacoco/lib/jacocoagent.jar=destfile=/tmp/jacoco_test/coverage.exec". Everything looks fine and runs without any errors. But when I convert coverage.exec to html report it shows 0% coverage. What's is the most curious thing, when I run "java -jar ~/tmp/java_coverage/jacoco/lib/jacococli.jar execinfo /tmp/jacoco_test/coverage.exec", I see there only test-related classes, while I expected to see test-covered (classes implementing business logic itself or classes under tests) classes as well. I understand that my guess might be wrong. So could you please clarify that I should see test-covered classes in the execinfo output as well?


Yes - to have non-zeros in report for classes, exec file should contain these classes.
BTW you can see the same information about content of exec file in HTML report on Sessions page, link to which is in right upper corner:

1.png


2.png

First to be sure let's clarify how your tests exercise classes under tests - are classes under tests in the same JVM as tests? if you put a breakpoint into class under test and execute test in debug, will the breakpoint be reached?



Regards,
Evgeny

Evgeny Mandrikov

unread,
Feb 1, 2019, 2:34:30 PM2/1/19
to JaCoCo and EclEmma Users
And I'm sorry for sending multiple message - for some reason Google Groups Web UI was replacing my screenshot by someones else ( https://twitter.com/_godin_/status/1091072154915954693 ).

Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages