Environment
- Server with Azure SQL
- Local with SQL Server Express
- Database deploy with SSDT
The plan
- [Developer] Run database unit test locally on SQL Server Express during development
- [DevOps] Once developer commit the changes, run all unit test cases in pipeline, proceed to deploy if all unit tests pass
The Issue
- [Test 1 - SQL Server Express 2019] Test project failed to deploy as Azure SQL uses a specific version of tSQLt (1.0.5873.27393) which fail with error
CREATE or ALTER ASSEMBLY for assembly 'tSQLtCLR' with the SAFE or EXTERNAL_ACCESS option failed because the 'clr strict security' option of sp_configure is set to 1.`
- [Test 2 - SQL Server Express 2014] Checked with
SELECT @@VERION
of 2014 and Azure SQL, the version number seem to be the same (12.0.2000.8), gave it a try but fails with errorA project which specifies Microsoft Azure SQL Database v12 as the target platform cannot be published to SQL Server 2014
Other possible solution
- Setup 2 difference project which include test cases from same project, where one with tSQLt for Azure SQL deployment and the other with tSQLt for SQL Server Express 2019 for local test (which I am not sure are there any difference between implements which may caused unpredictable errors)
- Create multiple Azure Sql for each developers so they can test in parallel (which sound stupid to me...)
Any comments on how to solve SQL Server Express issue or other possible solutions are very welcome.