Azure Devops pipeline - Generating SQL Test code coverage.
Hi,
I've got a nuget package being created by the "Redgate SQL Change Automation Build" task.
I'm then running the tSQLt tests against that package using the same task type.
This is running the tests, and reporting the test status correctly in the pipeline.
What I can't see is a way to generate the code coverage report that is shown in "SQL Test" and mentioned in this article.
Thanks,
I've got a nuget package being created by the "Redgate SQL Change Automation Build" task.
I'm then running the tSQLt tests against that package using the same task type.
This is running the tests, and reporting the test status correctly in the pipeline.
What I can't see is a way to generate the code coverage report that is shown in "SQL Test" and mentioned in this article.
Thanks,
Tagged:
Answers
Here are some documents that may help you with this, please be aware I've not tested any of this and it's purely theoretical and I'd be keen to know if it works!
So SQL Cover will output to OpenCover format, in the document, there's a link to the GitHub page that gives you the ReportGenerator.exe which can convert to formats such as Cobertura which is supported by ADO, these can then be published by Azure DevOps.
The following article may also be of interest surrounding this subject: https://nielsnijveldt.github.io/display-opencover-results-in-azure-devops/
Kind regards
Dan Calver | Redgate Software
Have you visited our Help Center?
Thanks for the response, but I think I probably needed to expand on my question.
I have the pipeline running SQL Tests via the RedgateSqlChangeAutomationBuild task:
I need to get the code coverage.
Does this task output the code coverage, if so, where is the file?
I'm happy to convert it to the correct format after I have the file, but so far I can't see how to get the coverage from this task.
From what I've read, it would seem that I have to abort using Redgate to get the coverage information.
Thanks.
I am afraid that this feature is not available on the add-ons, you will need to use a Powershell task instead:
https://documentation.red-gate.com/sca/deploying-database-changes/automated-deployments-with-sql-change-automation-projects/use-sqlcover-with-sql-change-automation-powershell-cmdlets
You can suggest this feature to be added to add-ons on our Uservoice forums at https://redgate.uservoice.com/forums/267000-sql-change-automation
Kind Regards,
Product Support Engineer
Redgate Software Ltd
Please see our Help Center for detailed guides on how to use our tools
Thanks for the response, do you know if the required SQLCover DLLs are included in the existing Redgate plugin?
Do you know how the existing plugin creates a local DB connection (as the documentation suggest we need to spin up an additional database to test a package)?
I don't really want to move away from using the redgate plugin, but if I'm having to hand-roll the solution I won't be using it to run the tests and submit the test report.
Thanks
Again thanks for the response.
Do you know if the Redgate SQL Change Automation Build task will update and start using the new builds of tSQLt?
If so would it be possible to add the code coverage at the same time?
Thanks