Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Coverage results via REST API

Tags:

jenkins

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?

like image 593
kimon Avatar asked Apr 10 '13 16:04

kimon


People also ask

How do I get code coverage results?

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.

What is API test coverage?

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.

How do you show test coverage?

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%.


1 Answers

If you append "?depth=2" to your query, you'll get additional percentage info. Higher values for depth show the individual file coverage.

like image 79
sas Avatar answered Sep 25 '22 10:09

sas