如何在测试挂起时停止Visual Studio Test Runner

时间:2021-07-22 16:33:41

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

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.

编辑:这在使用XUnit TestRunner时发生。取消按钮根本没有显示。在一个新的解决方案中测试了各种测试运行器之后,结果证明它适用于所有这些。最后,它也适用于我原来的解决方案。所以我的VS环境状态出现了一些异常,导致取消消失。

3 个解决方案

#1


55  

You can click "Cancel" in Test Explorer:

您可以在测试资源管理器中单击“取消”:

如何在测试挂起时停止Visual Studio Test Runner

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

通过转到TEST> Windows>测试资源管理器显示测试资源管理器。

This is in Visual Studio 2013.

这是在Visual Studio 2013中。

Instructions for other versions of VS can be found here

其他版本的VS的说明可以在这里找到

#2


3  

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

很抱歉醒来一个老线程:)只是想在这里分享我的解决方案,我在VS 2015上遇到了同样的问题。在搜索输入下面有一些文本只是取消应该出现的地方(看看@Codeman打印屏幕) ,文本实际上是关于如何为测试设置构建的一些描述,文本是几行,最后你有“不再显示这个”只需按下它然后出现取消按钮:)很奇怪bug,对不起,我没有一些打印屏幕,希望这对某人有所帮助

#3


-2  

enter image description hereI have found the solution to this issue. To stop the run after cancel is pressed. Just set 'Terminate process on cancel' option to True. enter image description here

在这里输入图像描述我找到了解决这个问题的方法。按下取消后停止运行。只需将“取消时终止进程”选项设置为True即可。在此处输入图像描述

#1


55  

You can click "Cancel" in Test Explorer:

您可以在测试资源管理器中单击“取消”:

如何在测试挂起时停止Visual Studio Test Runner

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

通过转到TEST> Windows>测试资源管理器显示测试资源管理器。

This is in Visual Studio 2013.

这是在Visual Studio 2013中。

Instructions for other versions of VS can be found here

其他版本的VS的说明可以在这里找到

#2


3  

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

很抱歉醒来一个老线程:)只是想在这里分享我的解决方案,我在VS 2015上遇到了同样的问题。在搜索输入下面有一些文本只是取消应该出现的地方(看看@Codeman打印屏幕) ,文本实际上是关于如何为测试设置构建的一些描述,文本是几行,最后你有“不再显示这个”只需按下它然后出现取消按钮:)很奇怪bug,对不起,我没有一些打印屏幕,希望这对某人有所帮助

#3


-2  

enter image description hereI have found the solution to this issue. To stop the run after cancel is pressed. Just set 'Terminate process on cancel' option to True. enter image description here

在这里输入图像描述我找到了解决这个问题的方法。按下取消后停止运行。只需将“取消时终止进程”选项设置为True即可。在此处输入图像描述