Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Run All cause a crash in VS2012 unit testing but running one by one doesn't?

We just "upgraded" from Visual Studio 2008 to Visual Studio 2012. We updated our unit tests and now they pass when running them individually but when I try to Run All, I got the following error:

The active Test Run was aborted because the execution process exited unexpectedly. To investigate further, enable local crash dumps either  at the machine level or for process vstest.executionengine.appcontainer.x86.exe. Go to more details: [http://go.microsoft.com/fwlink/?linkid=232477][1] 

So I went to the link and followed the instructions to add the registry key to enable local crash dumps. The error message then changed to:

The active Test Run was aborted because the execution process exited unexpectedly. Check the execution process logs for more information.  If the logs are not enabled, then enable the logs and try again. 

Apparently it noticed the changes that I made in the registry to enable crash. However, when I looked in %LOCALAPPDATA%\CrashDumps, no files were being created.

If I run one test at a time (or even a few tests at a time), I can get them all to pass. The problem is only with Run All.

Has anyone else encountered similar problems? If so, how did you solve them?

Essentially the same question was asked on MSDN, but the answer was something like "click the link to the crash dump". That answer doesn't help me because I don't see any link to the crash dump and I am unable to get the crash dump to be generated.

This question on StackOverflow is also similar, and ended up resulting in a bug being logged on Microsoft Connect (which looks to be deferred for some reason), but my problem might be different because my code has nothing to do with "async tasks" (I don't think).

EDIT: The problem went away, seemingly on its own, but the problem was likely an exception that wasn't being caught in the unit test code, as some of the answers below suggest. However, I'm still confused as to why the problem only appeared with Run All, and not when running smaller groups of tests or Debug All.

like image 444
sgryzko Avatar asked Oct 03 '13 21:10

sgryzko


People also ask

How do I run a single unit test in Visual Studio?

Run tests in Test Explorer If Test Explorer is not visible, choose Test on the Visual Studio menu, choose Windows, and then choose Test Explorer (or press Ctrl + E, T). As you run, write, and rerun your tests, the Test Explorer displays the results in a default grouping of Project, Namespace, and Class.

What is a Runsettings file?

runsettings file is to customize code coverage analysis. Run settings files can be used to configure tests that are run from the command line, from the IDE, or in a build workflow using Azure Test Plans or Team Foundation Server (TFS). Run settings files are optional.


1 Answers

I had the same problem, the tests failed for apparently no reason. Later I found that a buggy method was causing a StackOverflowException. When I fixed my bug, the VS bug disappeared.

Maybe it works most of the time because you don't run the faulty code.

like image 105
Doug Avatar answered Nov 10 '22 20:11

Doug