Issues with MSTest Command Line utility in Visual Studio 2013

Deepak Mittal, Support Escalation Engineer, shares his experience with MSTest command line utility in Visual Studio 2013 in this blog post. Read on..

Problem Description:

The MSTest 12.0.21005.1 command line utility (Part of Visual Studio 2013) is unable to run tests within a project that use the Microsoft.WindowsAzure.Caching.2.2.0.0 NuGet package.

Any tests utilizing classes within the mentioned azure caching libraries fails with the following test output/results:

 [Insert Test Method Name Here]

threw exception: System.IO.FileNotFoundException:
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.ApplicationServer.Caching.AzureClientHelper' or one of its dependencies. The system cannot find the file specified.

 Resolution:

There are two solutions to it:

 First Preposition:

 Either you can copy the Azure dlls to MSTEst.exe folder (C:\program files (x86)\Microsoft visual studio12.0\common7\IDE)

 Or

 Run tests using vstest.console.exe.vstest.console “path_to\AzureTests.dll”

Basically if you are on Team Build 2013 that is the exe (vstest.console.exe) gets used to execute the tests (test runner -> visual studio test runner), so you should
not face problem there. In Team Build 2012 also, you can use this option.

 

In fact it is better to avoid MSTest.exe as it is just for older version compatibility, not have great support for Azure.

 

Written by: Deepak Mittal, Support Escalation Engineer

Reviewed by: Teodora Stanev, Senior Escalation Engineer