Tracking growth in test coverage

I’m a Product Owner and SonarQube newbie - I’m looking for a simple way of tracking the “growth” of test coverage through the provision of a weekly report on the number of test cases the team has in a project? We have the Enterprise version.
Is there an easy way to export project data to excel - or at least to CSV for me to import?

Hi @GarethHardman ,

Welcome to SonarSource community! :wave:

There is no easy way to export project data because SonarQube is a developer-centric tool, but there are ways to get the data you want.

By “test case”, are you meaning “unit tests”? Also, unit test amount may not be the best metric to track for test coverage, so you probably want “code coverage” or just “coverage”. If so, from the UI, click on the project of interest and select “Activity” tab, then click on the drop-down near the chart and look for “Coverage”. This will give you a chart over the history of the project.

You can click on “Measures” tab and filter to get the Coverage and Unit Tests value also.

An alternative, but not so easy way would be to utilize the web API for your SonarQube instance. You can see more information in our docs here, Web API, and also in the Web API documentation on your SonarQube instance. Just click on the bottom footer for the “Web API” link or in the :question: icon next to the search bar in the top right-hand corner.

In it, you will find lots of different API endpoints to explore. For example, you can find number of unit tests: <SONARQUBE_HOSTNAME>/api/measures/component?component=<INSERT-YOUR-PROJECT-KEY>&metricKeys=tests. You can create a small script to curl this endpoint and do it weekly to see the change in unit test number.