I'm trying to get coverage results from Jenkins using the REST API and the Cobertura plugin.
It looks like I can get the top level information about coverage results since the Cobertura plugin puts the bottom line results in the healthReport of the job.
However, I would like more detailed information about code coverage.
So I tried:
<jenkins url>/job/<job>/<buildNo>/cobertura/api/json
I get just empty results. I assume from this the Cobertura plugin just didn't implement the API for returning this information.
Is there another way to get this information programatically other than modifying the Cobertura plugin?
Code coverage option is available under the Test menu when you run test methods using Test Explorer. The results table shows the percentage of the code executed in each assembly, class, and procedure. The source editor highlights the tested code.
The API Coverage tool is used to estimate the test coverage that a test suite under development affords to implementations of its related API specification. It does this by determining how many public class members the test suite references within the API specification that it is designed to test against.
It's most accurate when the established requirements are atomic. This metric is calculated according to the following formula: Test coverage = (number of claims covered by test cases/total number of claims)x100%.
If you append "?depth=2" to your query, you'll get additional percentage info. Higher values for depth show the individual file coverage.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With