Does sonar cloud code coverage of Transact-SQL script file cover as a whole or Individual sql statements inside the file?

What are we doing?

Implementing code coverage for Microsoft SQL Server Database Project

How we are doing?

  • “SQL Server Database” Project which contains stored procedure inside “Transact-SQL” script file
  • “MSTest Unit Test” project which contains unit tests for Sql files ( Overview -Test cases to execute the stored procedure by passing its parameter values)
  • Upload the results to the SonarCloud server using azure devops classic build pipeline as follows
  • “Prepare analysis on sonarcloud ” task with standalone scanner to run the analysis
  • “Visual Sudio Test” task to generate trx(test result) file and coverage file
  • Convert Coverage File into CoverageXML using CodeCoverage.exe
  • “Run Code Analysis” task to upload the CoverageXML results to the SonarCloud server

Sonar Cloud Code Coverage Report:

Expected: Expected 100% coverage to Transact-SQL script file as we written unit test case for stored procedure execution.

Actual : Showing 0.0% Coverage to Transact-SQL script file. We gone through the file and we noticed that with highlighted red color saying “Not covered by Tests” in every SQL (Ex: Select) statement and so on…

HELP NEEDED TO KNOW : Does sonar cloud code coverage of Transact-SQL script file cover as a whole or Individual statement inside the file?

Please someone can respond me with some suggestions/ideas and I am happy to provide more insight of the problem if required.

Waiting for some response…Thanks

Hello @Gangadhar,

Does the generated coverage file follow the format described by this documentation page?
Do the logs show that your generated coverage file is being imported?

I saw you opened up a duplicate thread: Code Coverage 0.0% for TSQL Projects(Contains Stored Procedures, Tables, Scripts etc), closing this one.