TSQLT Code coverage integration with SonarQube


After last failed attempt to resolve this, we have started working this again.
SQ version 7.9

Here are the steps we are performing,

  1. Compile the database solution
  2. Deploy a TSQLT dacpac on to database
  3. Ran below ps1 to run the tsqlt tests and generate the reports,
$baseDir = "C:\Users\xxx\SQLCover-0.5.0\src\SQLCover\releases\template"
$database = "TestDBName"
$server = "."
$coverageOutputDir = "C:\Users\xxx\SQLCover-0.5.0\src\SQLCover\releases\results" 
. "$baseDir\SQLCover.ps1" 
$results = Get-CoverTSql  "$baseDir\SQLCover.dll"  "server=$server;initial catalog=$database;integrated security=true;" "$database" "exec tSQLt.RunAll" 
New-Item -ItemType Directory -Force -Path $coverageOutputDir*
Export-OpenXml $results $coverageOutputDir
Export-Html $results  $coverageOutputDir

which gave Coverage.opencoverxml and Coverage.html

  1. Per your suggestion used the tool below to convert the Coverage.opencoverxml to sonarqube generic data
    GitHub - jmecosta/OpenCover2SonarConverter: Converts OpenCover to SonarQube format
  2. Passed this generic data file to SQ prepare task using sonar.coverageReportPaths.

Still no signs of code coverage Metrix on sonarqube dashboard :frowning:

Can you please let me know what are we missing?
Has anyone successfully ever integrated the TSQLT code coverage with SQ?
Is this because of the older version of SQ? Do you think we’ll be able re resolve this by upgrading the version to latest?

Any leads would greatly be appreciated.



Your version is past EOL. You should upgrade to either the latest version or the current LTS at your earliest convenience. Your upgrade path is:

7.9.* → 8.9.8 → 9.4 (last step optional)

You may find the Upgrade Guide and the LTS-to-LTS Upgrade Notes helpful. If you have questions about upgrading, feel free to open a new thread for that here.

If your error persists after upgrade, please come back to us with your full analysis log.


Hello Ann,

Thank you for your message.
We will consider upgrading the version soon.

But do you think upgrading the version will help us resolve the tsqlt code coverage integration issue with sonarqube? Are there any use cases/experience you have seen/heard regarding this same?



That’s a fair question, and to be honest, I have no clue. But I know we won’t be able to help you on your current version.