views:

1815

answers:

7

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. Does anyone have any ideas?

+13  A: 

What a PITA! The IDE doesn't show any errors. 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.

What a complete waste of my time!

Peter Morris
Very helpful, thanks. With regards to the IDE not showing the error, I found there is a "Test run error" link just above the results grid with a yellow background. Clicking on this returned the same message you get from the command prompt.
Daniel Ballinger
A: 

I agree. But thanks for saving my time!

Rick.

A: 

I've done this and found that it's still reporting as untrusted. I've verified that "unblock" was checked for each Rhino.Mocks file. Any other ideas for how to debug this?

+2  A: 

Unit tests not executed

I've found that it is good advice to never have a constructor for a unit test class. If anything in a constructor ever throws, the test will just be reported as "not executed". Put test initialization in a TestInitialize method instead. Exceptions thrown there are reported by the IDE.

Blocked Binaries

Usually you have to unblock the ZIP file itself before you extract binaries from it, and then all the binaries will be unblocked. If you try to unblock the binaries themselves the unblocking doesn't "stick".

Eric Smith
+3  A: 

There's a link "Test run error" in the Test Results window that shows the same error messages in Visual Studio ( no need to run mstest )

A: 

I'm having the same problem with log4net.dll and its driving me crazy. I've done all of the standard things:

1) used caspol to grant full trust to the directory 2) did the "unblock" thing

but still joy...is there anything else that I can try?

A: 

Hi, I have the some problem, but when you say unblock What does it mean?? Can you please explain more in detail.. Thinks

nbouse
Go to the DLL in windows explorer.Right click it.Properties.There is an UNBLOCK button. Files downloaded from the Internet are automatically marked as "blocked".
Peter Morris