Historical test coverage data for a given class/method

100 views Asked by At

We are trying to pull historical test coverage data (more like weekly/mothly trend) for a given resource. At a project level we are able to fetch required data by using the API https://sonar-service/api/resources?resource=com.demo.project:demo-project&metrics=new_coverage&includetrends=true.

But the same is not working if we try to fetch information at a class level (https://sonar-service/api/resources?resource=com.demo.project:demo-project:src/main/java/com/demoClass.java&metrics=new_coverage&includetrends=true). It simply returns current value.

Is there any way to fetch historical coverage data for a given class/method (either by using APIs or querying Database).

If it is not possible in Sonarqube 5.x & below, do we have any simpler way in 6.x version of Sonarqube.

1

There are 1 answers

1
G. Ann - SonarSource Team On

Historical data is not retained at the file level. I don't believe it ever has been.