Search code examples
sql-servervisual-studio-codeazure-devopssql-server-data-toolsdatabase-project

SQL Database Projects (VS Code) Unit Tests Migration


I have inherited an SSDT project that I am in the process of migrating over to the newer SQL Database project in VS Code (.NET Core).

The aim is to create a Linux-based CI/CD pipeline in Azure DevOps.

I'm pleased to say I have successfully migrated the database objects which build and deploy using a Linux-based build agent to an Azure SQL instance.

However, I have been left with unit tests (written in .NET Framework) which I would like to migrate and incorporate into a CI pipeline.

Having searched the web I've found nothing on the subject of unit tests in the VS Code version of SSDT. There doesn't seem to be a .NET Core equivalent of the Microsoft.Data.Tools.Schema.Sql.UnitTesting library.

Before I give up. Has anyone migrated unit tests over to the new SQL Database project? Or can say definitively whether this is or isn't possible?


Solution

  • The answer is no, well at least for now. I ended up asking the guys over at microsoft/azuredatastudio

    There isn't an immediate plan for this, but it is on our radar: #12975

    In addition to the .NET SQL unit tests, the community library tSQLt is a good > option for unit testing against SQL projects. (deploy project and unit tests > to container in pipeline, run tests)

    I will look into tSQLt and see if I can migrate the existing tests over.