I have a problem running data driven unit tests (MSTest) in VSTS. My situation is the following: In my C# solution I have a MSTest-test project which contains three test classes that contain data driven test methods. These methods used to work with an attached MDF-file as data source, but for reasons of maintainability I added a database-project to my solution which contains the scripts to create and fill a database with my test data.
The test-project also contains an initialize method (marked with the AssemblyInitialize attribute) which deploys the dacpac from the database-project) to a LocalDB-instance. For this deployment I use the Microsoft.SqlServer.DACFx NuGet-package.
The data driven test methods all use the following connection string Data Source=(LocalDB)\v11.0;Initial Catalog=Enkoni_Validation_Tests;Integrated Security=True;Connect Timeout=30 The problem is that this solution workes locally without any problems, but when I trigger a build on VSTS, most of the tests run fine, but one test class constantly failes with the message
"The unit test adapter failed to connect to the data source or to read the data. (...) Error details: Cannot open database "Enkoni_Validation_Tests" requested by the login. The login failed."
The testmethods in the other two classes run without any problems. Since all three test classes are part of the same project, I assume the initialization (the deployment of the DacPac) runs without problems. Has anyone experienced a similar problem or does anyone know how to solve this?
Aucun commentaire:
Enregistrer un commentaire