Code coverage of SQL unit testing with tSQLt tool and integrating in Sonarqube dashboard

We’re using tSQLt for SQL unit test cases and integrated with Azure DevOps for build pipeline using Redgate SQL Change Automation:build task. Now I got result as “TestResults.junit.xml” and published to Tests summary. But code coverage is not showing. We want to show the this code coverage and want to integrate this coverage with in Sonarqube dashboard.

Kindly suggest on how could we do this. Thanks.

Hi @upendaravireni,

SonarQube doesn’t have native coverage import for T-SQL. So you’ll need to convert your TestResults.junit.xml file to our Generic Coverage format, then set sonar.coverageReportPaths to point to the resulting generic coverage file.

Regards,

Cameron.