Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 676
citykid Avatar asked Jan 22 '14 18:01

citykid


People also ask

How do I stop live unit testing?

You can turn off Live Unit Testing by going to Menu Test -> Live Unit Testing -> stop. Additionally, you can also check the tools | option | Live Unit Testing and make sure that the option to "Start Live Unit Testing on solution load" is unchecked.

How long should a test suite take to run?

The test suite you work with when you do TDD should execute in less than 10 seconds on your machine. If you have hundreds of tests, each test should be faster than 100 milliseconds. If you have thousands, each test should be faster than 10 milliseconds. You get the picture.


2 Answers

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

like image 132
Codeman Avatar answered Oct 03 '22 12:10

Codeman


Sorry for waking up an old thread:) just wanted to share my solution here, I had the same issue on VS 2015. There is some text below the search input just where the cancel should appear (take a look at @Codeman print screen), the text is actually some description on how you can setup a build for your tests, the text is several lines and at the end you have "do not show this any more" just press it and then the cancel button appears:) Very strange bug, sorry I do not have some print screens of this hope it helps someone

like image 27
Michael Sherling Avatar answered Oct 03 '22 13:10

Michael Sherling