16
votes

I used to be able to run unit tests in VS 2012. Now, all of a sudden, whether I try to "Run" or "Debug" any unit tests, the Unit Test Sessions window puts the test into "Pending" status, but never actually executes it.

I've tried restarting my dev environment, even rebooting the computer. No change.

So where is the secret setting that says "Make unit tests freeze at 'Pending'"?

4
Off topic, but definitely had a giggle at "all of a sardine".Chris Dixon
You seem to be using ReSharper or something, "Unit test sessions"John Saunders
Which unit test framework are you using?Tiago Almeida
Its a resharper issue - devnet.jetbrains.com/thread/442769. Check if your Resharper and/or VS2012 versions are the ones affecteduser1378730
In visual studio go Test->Run->All Tests or press CTRL+R, A, looks like resharper doesn't support MS Tests very well.Tiago Almeida

4 Answers

10
votes

My answer in the comments was correct

Its a resharper issue - see here. Check if your Resharper and/or VS2012 versions are the ones affected

5
votes

I thought I'd add this in case it helps others, I did these steps...

  • Closed VS and reopened, running as Administrator.
  • Cleaned the solution, and rebuilt
  • Kicked off the tests, and they started working again

It might have been that I needed to only run as admin, but I thought I'd add all the steps I did.

4
votes

Goto Resharper -> Options -> General and hit the button "Clear Caches". Restart Visual Studio and unit testing should work again. No idea why this happened to me all of the sudden.

2
votes

I have no idea what state your machine is in but what I would do, like debugging the code I would try and narrow down the route of the issue, So for example

  1. Check to see if your unit test has an initializer method, if it has then put a break point there and see what happens when you debug your test.

  2. Check your settings both bitness and platform ... so 64bit or 86 or AnyCPU and also debug or release settings.

  3. Finally try running a fake simple test that you can just write in seconds and see if you can narrow it down that.