Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cancelling TestContext on non [Timeout] [TestMethod] should still cancel test #1305

Closed
Evangelink opened this issue Oct 1, 2022 · 2 comments

Comments

@Evangelink
Copy link
Member

Evangelink commented Oct 1, 2022

Description

With current implementation, the CancellationTokenSource property of the TestContext always allows you to cancel a test but if the [TestMethod] is not marked with [Timeout] nothing will happen. This seems like a confusing behavior and as a user I would expect that my manual cancellation request is honored.

AB#2050315

@testplatform-bot
Copy link
Contributor

✅ Successfully linked to Azure Boards work item(s):

@Evangelink
Copy link
Member Author

After some discussions and tests, the feature doesn't make much sense. For a user to call Cancel on the token of the TestContext that means we are already in the user code so they could simply return or throw. There is also no need to start a different thread and stop observing it (as we do for timeout) because once again the user is in control and can exit the method execution so they are never blocked.

For these reasons we decided not to implement this feature.

@Evangelink Evangelink closed this as not planned Won't fix, can't repro, duplicate, stale May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants