Unit tests using JUnit 4 are not being accounted for, whereas those written in JUnit 5 are

62 views
Skip to first unread message

Magali Kain

unread,
Jan 17, 2024, 2:19:22 AMJan 17
to JaCoCo and EclEmma Users
Hello,

I am using Jacoco 0.8.11, Camel 3.20, and Spring Boot 2.7.18. When I run the task to check the project's coverage, the unit tests using JUnit 4 are not being accounted for, whereas those written in JUnit 5 are. I would like to clarify that these tests do not validate exceptions.

Any idea why the tests with JUnit 4 are not being counted?

Thanks in advance,
Magali

Florian McKee

unread,
Jan 17, 2024, 10:05:39 AMJan 17
to JaCoCo and EclEmma Users
Wild guess: Can you confirm that the tests are being executed? I've seen a lot of projects that forget to add the JUnit Vintage Runner when mixing JUnit 4 and JUnit 5. As a result, the JUnit 4 tests are silently ignored.

See: https://junit.org/junit5/docs/current/user-guide/#migrating-from-junit4

Florian

Magali Kain

unread,
Jan 17, 2024, 11:18:00 AMJan 17
to JaCoCo and EclEmma Users
Hi Florian, 

Yes, tests are being executed.

Marc Hoffmann

unread,
Jan 17, 2024, 11:22:25 AMJan 17
to JaCoCo and EclEmma Users
Hi Magil,

more wild guessing here: are JUnit 4 tests and JUnit 5 tests mixed in the same modules? Or in separate modules with different configuration?

In general we always recommend that you extract a small reproducer (Github repository) that demonstrates the problem. So the experts can have a look and identify the problem.

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/5d6a0fac-ee65-4a7d-a7e4-78e4d5acd489n%40googlegroups.com.

Ankit Srivastava

unread,
Jan 17, 2024, 11:32:37 AMJan 17
to JaCoCo and EclEmma Users
Hi Magali,

Can you pls share your code to understand problem better ?

Thanks
Ankit



Reply all
Reply to author
Forward
0 new messages