Search code examples
unit-testingvisual-studio-2012mstestmicrosoft-fakes

Can't run unit test Visual Studio 2012 Ultimate


When I try to run a specific test on Visual Studio 2012 Ultimate, I have an error message : "Process with an Id of -1 is not running" (not sure of the translation, sorry). And when I try to execute all the tests, the error message is "The specified file can't be found".

All my tests are detected, but none are executed. I've spent two days trying to make these tests work: recreating the test project, running the tested project under IISExpress instead of IIS, renaming the IISExpress folder in My Documents, forcing the compilation for x86 or x64, removing fakes assemblies, cleaning solution... nothing worked.

I use the built-in MSTest framework, and no specific framework is installed.

Here is the message I get in debug:

enter image description here

And here is what I get when I "only" execute:

enter image description here

English error messages:

------ Run test started ------
Process with an Id of -1 is not running.
========== Run test finished: 0 run (0:00:00,1050004) ==========

------ Run test started ------
The system cannot find the file specified
========== Run test finished: 0 run (0:05:16,7847051) ==========

Solution

  • After debugging Visual Studio itself it turns out that Visual Studio is trying to launch vstest.executionengine.x86.exe.

    Debugging Visual Studio itself

    Which doesn't exist in your instance of 2012:

    Files in that path

    Solution

    I repaired Visual Studio 2012 from the Programs and Features panel of Windows and that fixed the tests. Upgrading it to Visual Studio 2012.4 seems to keep the tests in a running state. If you choose to repair 2012, make sure you also re-apply the latest update pack (Update 4), if you had an update installed.

    Opening the project in Visual Studio 2013.4 or 2015 Preview also seems to work. So it seems that something has broken Visual Studio 2012 Ultimate somehow and repairing it resolves the issue.