Instruction shown as not covered but debugger steps into

57 views
Skip to first unread message

Simon Martinelli

unread,
Dec 3, 2021, 11:01:22 AM12/3/21
to JaCoCo and EclEmma Users
Hi,
I have a simple class and the report looks like this:


Screenshot 2021-12-03 170036.png

I'm 100% sure that line 13 is called why does it report that the instruction was missed?

Thanks Simon

Marc Hoffmann

unread,
Dec 4, 2021, 2:43:47 AM12/4/21
to JaCoCo and EclEmma Users
Hi Simon,

I quickly tested you scenario and I cannot reproduce this. If you provide a executable reproducer (e.g. Github Repo with Maven build) we can analyse the problem you see.

Cheers,
-marc


Simon.java
PastedGraphic-1.tiff

Simon Martinelli

unread,
Dec 7, 2021, 5:07:39 AM12/7/21
to JaCoCo and EclEmma Users
Hi Marc,


Checkout the develop branch and run the tests with the profile "coverage"

Thanks, Simon

Marc Hoffmann

unread,
Dec 7, 2021, 3:09:13 PM12/7/21
to JaCoCo and EclEmma Users
Hi Simon,

I can’t find a isEmpty() method in this repo on branch develop that looks like the one in your initial post:


Cheers,
-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/84cc6c0c-600d-4c3a-bf35-94e49b75e6c0n%40googlegroups.com.

Simon Martinelli

unread,
Dec 8, 2021, 1:46:46 AM12/8/21
to JaCoCo and EclEmma Users
Hi Marc,

Yes you are right, I'm sorry. This is the same but just a bit differently structured.
I've now committed the code as it is in the example. 

But the code coverage report looks the same. 


Thanks for your help
Simon

Evgeny Mandrikov

unread,
Dec 9, 2021, 5:59:28 AM12/9/21
to JaCoCo and EclEmma Users
Hi Simon,

StringUtilTest is not executed,
the only executed test is UtPlsqlMojoTest.

Also you can observe that execution of
mvn clean verify -P coverage -DskipITs -Dtest=\*StringUtil\*
fails with message
No tests were executed!

StringUtilTest is JUnit 5 test,
whereas UtPlsqlMojoTest is JUnit 4 test.

You're using maven-surefire-plugin version 2.12.4, however
to execute JUnit 5 tests you need at least maven-surefire-plugin version 2.22.0 - see https://issues.apache.org/jira/browse/SUREFIRE-1330

After addition to your pom.xml of
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.2</version>
            </plugin>

Same command succeeds, executes StringUtilTest and produces following expected report
Screenshot 2021-12-09 at 11.58.49.png

Simon Martinelli

unread,
Dec 9, 2021, 2:07:20 PM12/9/21
to JaCoCo and EclEmma Users
Hi Evgeny 

Didn't spot this problem 😅

Thank you very much! 
Simon
Reply all
Reply to author
Forward
0 new messages