Failed to deploy database project error during database testing

When you create database test in a MsTest project, usually it configure an initialization method that deploy the database schema before test runs.

1
2
3
4
5
6
[AssemblyInitialize()]
public static void IntializeAssembly(TestContext ctx)
{
    //Setup the test database based on setting in the
    //configuration file
    DatabaseTestClass.TestService.DeployDatabaseProject();

If something went wrong during this phase you probably will end with this not so much useful error message: Failed to deploy database project …

image

And if you look at test result you have no more clue on what is actually failing.

image

To see actual error you need to look at the Run details

image

Now you can see much more useful information on what is really gone wrong.

image

From this log you can verify that some post build action went wrong. So do not forget to always take a look at run detail to have detail on what is the reason of failure of the test.

Alk.

Tags: MsTest