Why are all my Visual Studio unit test results "Not executed"

When I run my unit tests in my project I am seeing a result "Not executed" for every one. I have restarted my computer so I doubt this is some kind of hung process issue.

Google has revealed nothing that is not related to load balancing, and I am not load balancing!

Solved

In order to determine the error you have to do this

  1. Open the Visual Studio command prompt
  2. Change to the directory where the binary output of your test project is.
  3. Type mstest /testcontainer:The.Name.Of.Your.Test.Assembly.dll

At the bottom of the output you will see the following text

Run has the following issue(s):

In my case it was the following:

Failed to queue test run 'Peter Morris@PETERMORRIS-PC 2009-02-09 10:00:37': Test Run deployment issue: The location of the file or directory 'C:\SomePath\SomeProject.Tests\bin\Debug\Rhino.Mocks.dll' is not trusted.

Now if VS had told me this in the IDE I could have fixed it in minutes! All you have to do is open Windows Explorer and find that DLL. Right-click on it and go to Properties. Then click the "Unblock" button.

If the IDE had told me the reason then it would have taken me 5 minutes to fix (as it did once I knew what it was)

Comments

MrJavaGuy said…
I have had this happen when missing the local test configuration file.
Hi Eric :-)

Where would I expect to find that file, and if it is missing what do I do to remedy it?
MrJavaGuy said…
see http://msdn.microsoft.com/en-us/library/ms182480.aspx
Thanks for the info but it didn't work :-(

My solution had a config file. I tried deleting it and creating a new one but I see exactly the same behaviour.
MrJavaGuy said…
In the test results window, the third icon from the left is the "Run Details". This might give you more information on why the tests are failing.
Anonymous said…
Interesting. I've had this problem before but VS always told me the error message.
Jess said…
You should be able to see a structured log of the test run (even with these kinds of problems) by looking at the corresponding .trx file. This saves you the trouble of having to run mstest manually.

Popular posts from this blog

Connascence

Convert absolute path to relative path

Printing bitmaps using CPCL