Code Coverage in Spring Boot and Maven Projects

Answered

I am having issues with trying to use the code coverage on a spring boot project. I use maven as the build system. If I drop the Jacoco plugin in maven, I can get a report. If I right click a unit test and run it I can add it to the code coverage suite. What I really want is a 1 click button that will run all the tests in the project and then give me the coverage report. When I hit the coverage button at the top of the project it just launches the spring boot app. Is there a way to tell Idea to run all the tests in code coverage mode sort of like mvn test? Clicking on them one by one and adding the data to the current report is pretty much unusable as we have tons of unit tests.

 

Thanks!

0
2 comments

You can create JUnit run/debug configuration for all the tests and run it with coverage: https://www.jetbrains.com/help/idea/2016.3/run-debug-configuration-junit.html (All in package, All in directory, etc).

2
Avatar
Permanently deleted user

That works perfectly! Thank you so much!

0

Please sign in to leave a comment.