views:

2200

answers:

9

We are using VS 2008 Team System with the automated test suite, and upon running tests the test host "randomly" locks up. I actually have to kill the VSTestHost process and re-run the tests to get something to happen, otherwise all tests sit in a "pending" state.

Has anyone experience similar behavior and know of a fix? We have 3 developers here experiencing the same behavior.

+2  A: 

When you say lock up, do you mean VS is actually hung, or do the tests not run?

The easiest way to track down what is going on would be to look at a dump of the hung process. If you are on Vista, just right-click on the process and choose to create a memory dump. If you are on Windows XP, and don't have the Debugging Tools for Windows installed, you can get a memory dump using ntsd.exe. You'll need the process ID, which you can get from Task Manager by adding the PID column to the Processes tab display.

Once you have that, run the following commands:

ntsd -p <PID>
.dump C:\mydump.dmp

You can then either inspect that dump using WinDBG and SOS or if you can post the dump somewhere I'd be happy to take a look at it.

In any case, you'll want to likely take two dumps about a minute apart. That way if you do things like !runaway you can see which threads are working which will help you track down why it is hanging.

One other question - are you on VS2008 SP1?

Cory Foy
+2  A: 

I would try running the tests from the command line using MSTest.exe. This might help isolate the problem to Visual Studio, and at least give you some method of running the tests successfully.

tbreffni
+2  A: 

When I say lock up I mean the screen to execute tests opens, every test goes into a "pending" run status, and nothing ever happens; everything just sits in a pending mode unless I close visual studio or manually kill the VSTestHost process.

After I kill the VSTestHost process and run my batch of tests again, everything usually works as it should. Very random, usually 5-ish times a day does this happen out of about 15 or so test runs.

Still hoping to hear that someone running Visual Studio Team System Testing has experienced the same behavior...

+5  A: 

I'm having the same problem. I can't believe just how crappy MS Test is compared to any other testing framework I've used.

My colleague Mike has a nice write-up on it.

IainMH
+3  A: 

I'm having the same problem, but only when I try to debug a test, and it happens every time. Looks like I'll have to read up on WinDBG and SOS before I can do anything to fix it.

Rory MacLeod
These are my exact symptoms as well.
Nicholas Piasecki
I'm also getting this with VS2010 B2 now :( Never with VS2008 ....
Pure.Krome
+3  A: 

I also have the exact same problem and generally kill VSTestHost.exe.

2/12/2010 - Having issue also. Just killing the VSTestHost.exe works for me.
+4  A: 

This may be related to an obscure bug that causes unit tests to hang unless the computer name is UPPERCASE. Crazy, I know - but I had this problem and the fix worked for me.

Bug report on MS Connect
Workaround on MS Connect
TFS Blog Article about this issue
HowTo edit the registry to change your computer name

The easiest approach is to tweak the registry. You need to edit two keys:

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ActiveComputerName
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ComputerName

Change value ComputerName to be upper case in both keys, and restart. Tests then magically work.

Tim Long
WTF? That is terrible.
IainMH
That's what we call Epic Fail :D
Stephane
Hmm they are both in uppercase with me, but the test still hangs :(
Zidad
A: 

I am getting this as well. Is there a fix for it? My reg settings say my computer name is "COMP-NAME" all uppercase bar the hyphen.

Is there a known fix for it?

Burt
A: 

I also ran in that issue today.

If VSTestHost.exe hangs with 100% try this BugFix: http://stackoverflow.com/questions/1417021/vs2008-unit-test-pending-and-the-test-cannot-be-completed/1417154

Christoph Ungersböck