Code Coverage for SQL Project

Trying to get code analysis for SQL projects. I tried to implement this like .Net project, build task and VSTEST task in between Prepare task and Run analysis. It seems to be failing unit test for SQL Project with error “Failed to Deploy Database”. Later I used Standalone Scanner in the prepare SonarCloud analysis task in the Azure DevOps build, still nothing in the code coverage unlike .Net project . Could you help getting me resolve this?

Welcome to the community!

I’m not sure I understand correctly. If running unit test fails, then it seems natural that code coverage information does not get produced, and therefore it cannot appear on SonarCloud.

Did the step of running unit tests work in this setup? Can you see the test coverage files produced during the build? Can you see anything in the logs concerning those files?