vstest icon indicating copy to clipboard operation
vstest copied to clipboard

ITestExecutor Cancel does not appear to be called

Open jpribele opened this issue 2 years ago • 1 comments

Description

The Cancel method of an ITestExecutor does not appear to be called

Steps to reproduce

Create an implementation of ITestExecuter Create a long running test that test executer would execute Run a the long running test Hit the cancel button in the text explorer

Expected behavior

Cancel method is invoke

Actual behavior

Nothing

Diagnostic logs

Environment

Visual Studio 2022 Version 17.5.0

jpribele avatar Feb 27 '23 21:02 jpribele

I run into the same issue public void Cancel() is not called when pressing the stop button on Test Explorer But on console it shows ========== Test run aborted: 1 Tests (1 Passed, 0 Failed, 0 Skipped) run in < 1 ms ==========

MikeSchulze avatar Feb 24 '24 09:02 MikeSchulze

This is by-design (or rather: too late to change it now).

nohwnd avatar Jul 09 '24 10:07 nohwnd

You're not serious now, are you?

The ITestExecutor is an official interface and should be supported by default! https://github.com/microsoft/vstest/blob/main/src/Microsoft.TestPlatform.ObjectModel/Adapter/Interfaces/ITestExecutor.cs

The answer is probably below par ...

MikeSchulze avatar Jul 09 '24 13:07 MikeSchulze

I am not, this was done to keep the interactive experience in VS responsive. When abort is pressed everything tears down as fast as possible.

nohwnd avatar Jul 10 '24 08:07 nohwnd

The problem is that if a test hangs for some unknown reason, it must be possible to cancel the test execution. Otherwise, this would mean I would have to close and reopen the IDE to solve the problem, which is very inconvenient.

MikeSchulze avatar Jul 10 '24 08:07 MikeSchulze