Skip Navigation

Seeking working example of Junit5 and code coverage with maven

This is kind of an open question for me: does any code coverage tool work in Java with Junit5? I'll admit that I'm no Java configuration specialist, so I find the complexity of XML-based configuration systems to be quite opaque. I've got a few simple Maven-based build projects on hand and I wanted to add code coverage to the test harnesses. Unfortunately, I have never managed to get one stood up and running. I do this all the time with Python pytest/coverage tools, but it's been elusive for Java projects.

Could someone here please point me to a working example of any Java project using Maven / Junit5 / [any code coverage system]?

My latest attempt to get a working example came from this howto: https://howtodoinjava.com/junit5/jacoco-test-coverage/

But, it once again gave me the: [INFO] --- jacoco-maven-plugin:0.8.7:report (default-report) @ JUnit5Examples --- [INFO] Skipping JaCoCo execution due to missing execution data file.

As near as I can tell, JaCoCo just never runs. Ever. It's been very frustrating. I've read tutorials, followed suggestions on configuring surefire in various ways. I've pulled misc repo that claim to have it working. I've tried different computers with different OSes, versions of java, different maven installs, etc. There's something somewhere that I'm missing and after months of off and on attempts to get this working I'm at my wit's end.

Please help.

1