How can I stop the Visual Studio Test Runner when a test hangs

citykid picture citykid · Jan 22, 2014 · Viewed 29.7k times · Source

When a test hangs in a loop, the small green progress bar in the test runner does not proceed, but there is no way to stop the test run. Or is there?

VS 2013

Edit: This occured when using the XUnit TestRunner. The Cancel button simply did not show up. After testing various test runners in a new solution, it turned out, that it works with all of them. Finally it also worked with my original solution. So there was some anomaly in the state of my VS environment that caused cancel to disapper.

Answer

Codeman picture Codeman · Jan 22, 2014

You can click "Cancel" in Test Explorer:

enter image description here

Show Test Explorer by going to TEST > Windows > Test Explorer.

This is in Visual Studio 2013.

Instructions for other versions of VS can be found here