JaCoCo Coverage of methods being invoked directly from a test case.

60 views
Skip to first unread message

Firhard Roslan

unread,
Jun 14, 2023, 11:51:05 AM6/14/23
to JaCoCo and EclEmma Users
Hi there,

I am trying to get the coverage of direct invocation of the method from the test suite.

As an example,
@Test
public void testPublicMethod()
{
    App app = new App();
    int x = app.publicMethod();
    assertEquals(x,10);
}

Assuming that publicMethod() calls another method internally, JaCoCo will also make the other method as being covered. Is there a way to only collect the method that is being called by the test cases directly?

Many thanks
Firhard

Marc Hoffmann

unread,
Jun 15, 2023, 4:57:03 PM6/15/23
to JaCoCo and EclEmma Users
Hi Firhard,

JaCoCo is framework agnostic. It simply records all executed code. JaCoCo does not know the difference between test code and application code. Als JaCoCo does not track call hierarchies. So unfortunately what you want is not possible.

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/6e4a8003-3aab-4300-9af8-3553e0ceb5c7n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages