We are using an Azure DevOps Release Pipeline to deploy a dacpac to a server which does not have Visual Studio installed. This all works great. We now wish to run some database Unit tests against this database. We have a step in the pipeline that runs the "Visual Studio Test Platform Installer" and gets the latest stable version of vstest.console.exe from Nuget and places it in the Tools folder for the Azure Release Agent on the server. The Visual Studio Test task then attempts to run the test assembly against the test platform installed by the tools installer. The error we then get is:
"Assembly Initialization method FulcrumDemoUnitTest.SqlDatabaseSetup.InitializeAssembly threw exception. System.TypeInitializationException: System.TypeInitializationException: The type initializer for 'Microsoft.Data.Tools.Schema.Sql.UnitTesting.SqlDatabaseTestClass' threw an exception. ---> System.TypeInitializationException: The type initializer for 'Microsoft.Data.Tools.Schema.Sql.UnitTesting.SqlDatabaseTestService' threw an exception. ---> System.Runtime.InteropServices.COMException: Element not found. (Exception from HRESULT: 0x80070490). Aborting test execution."
It looks like the vstest runner does not support the SQL unit testing dlls We have installed SSDT as well with no joy.
Has anyone else experienced this or indeed managed to get SQL unit tests to run via Azure Pipelines without Visual Studio installed on the target box?
Any insights would be gratefully received.
User contributions licensed under CC BY-SA 3.0