I have a Java RESTful API. I use REST Assured for my functional tests on each endpoint.
Is there a way to get the code coverage for the classes/methods used behind the scene (controllers, services, DAOs/repositories, etc.) when REST Assured (or any similar tool) makes calls to the API? (I guess the API should be started with some agent or something that reports what happens until it is stopped?).
-
You could try using attribute tags above your methods and have Maven evaluate your code coverage.ElementCR– ElementCR2017年05月10日 18:11:27 +00:00Commented May 10, 2017 at 18:11
1 Answer 1
I ended up using JaCoCo (Java agent and Maven plugin) with SonarQube
EDIT after Sikandar's comment:
In my case it's a Spring Boot app so when I run the jar file I add the option
-javaagent:/myapp/lib/jacoco.agent-0.7.9.jar=destfile=/myapp/coverage-reports/jacoco-at.exec
Reports are generated when the app is stopped. Then I configured SonarQube to use the file /myapp/coverage-reports/jacoco-at.exec
for its analysis
2 Comments
Explore related questions
See similar questions with these tags.