views:

456

answers:

0

Within Visual Studio 2008 SP1, you can create a unit test project which uses MSTest as the test runner. I've been writing tests now at work that test unmanaged C++ MFC from the managed MSTest project, and it's been quite an interesting ride.

There seems to be a difference between using the IDE's test runner versus using the command line application, MSTest.exe. In my scenario, the tests will run fine within the IDE and all tests will pass, yet if you run the command line test runner, MSTest.exe will hang while trying to load the unit test DLL.

This appears to be a problem with a missing dependency within the DLL. When I load up the unit test DLL in Depends.exe (Dependency Walker), Depends.exe will complain that it can't find msvcr90d.dll, which is the VS2008 debug C runtime. I copied that file to the Out folder for the test run and tried running mstest on the test DLL but it didn't fix the problem. Any ideas?

I could add some DeploymentItems to the tests or to the testrunconfig, but I have no way of finding out what I need to add. Any ideas for finding what items should be added as DeploymentItems?

This happens when I test against a static lib that has the CWinApp object removed. I think I have to remove it so that there aren't two CWinApp instances, right?

I've looked at this help article in the MSDN forums, but it hasn't solved my problem: http://social.msdn.microsoft.com/forums/en-US/vststest/thread/aa7f7567-faba-4589-b0ae-fe8d2c831c7a/ I'm not sure which assembly is missing and there are so many entries within Process Monitor that it seems impossible to find the missing one. Any help?