# TSQLT Code coverage integration with SonarQube

**URL:** <https://community.sonarsource.com/t/tsqlt-code-coverage-integration-with-sonarqube/62328>\
**Category:** SonarQube Server / Community Build\
**Tags:** tsql, sonarqube, coverage\
**Created:** [April 27, 2022, 3:50pm UTC](https://community.sonarsource.com/t/tsqlt-code-coverage-integration-with-sonarqube/62328 "2022-04-27T15:50:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![neet.neet14](https://avatars.discourse-cdn.com/v4/letter/n/e36b37/32.png) [@neet.neet14](https://community.sonarsource.com/u/neet.neet14)\
**Post date:** [April 27, 2022, 3:50pm UTC](https://community.sonarsource.com/t/tsqlt-code-coverage-integration-with-sonarqube/62328/1 "2022-04-27T15:50:48Z")

</div>

Hello,

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,

```auto
$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](https://github.com/jmecosta/OpenCover2SonarConverter)
2. Passed this generic data file to SQ prepare task using sonar.coverageReportPaths.  
sonar.coverageReportPaths=$(Build.SourcesDirectory)\Databases\merged.cov.json

Still no signs of code coverage Metrix on sonarqube dashboard ☹

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.

Thanks

---

<div class="post-metadata">

**Author:** ![ganncamp](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ganncamp/32/1261_2.png) [@ganncamp](https://community.sonarsource.com/u/ganncamp)\
**Post date:** [April 27, 2022, 4:22pm UTC](https://community.sonarsource.com/t/tsqlt-code-coverage-integration-with-sonarqube/62328/2 "2022-04-27T16:22:30Z")

</div>

Hi,

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](https://docs.sonarqube.org/latest/setup/upgrading/) and the [LTS-to-LTS Upgrade Notes](https://docs.sonarqube.org/8.9/setup/lts-to-lts-upgrade-notes/) helpful. If you have questions about upgrading, feel free to open a new thread for that [here](https://community.sonarsource.com/tag/8-9-lts-upgrade).

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

&nbsp;  
Ann

---

<div class="post-metadata">

**Author:** ![neet.neet14](https://avatars.discourse-cdn.com/v4/letter/n/e36b37/32.png) [@neet.neet14](https://community.sonarsource.com/u/neet.neet14)\
**Post date:** [April 27, 2022, 6:45pm UTC](https://community.sonarsource.com/t/tsqlt-code-coverage-integration-with-sonarqube/62328/3 "2022-04-27T18:45:16Z")

</div>

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?

Thanks

---

<div class="post-metadata">

**Author:** ![ganncamp](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ganncamp/32/1261_2.png) [@ganncamp](https://community.sonarsource.com/u/ganncamp)\
**Post date:** [April 27, 2022, 6:47pm UTC](https://community.sonarsource.com/t/tsqlt-code-coverage-integration-with-sonarqube/62328/4 "2022-04-27T18:47:17Z")

</div>

Hi,

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.

&nbsp;  
Ann
