microsoft / microsoft/testfx

Discuss TestContext cancellation

Open
#6,157 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/mstest needs/design
Dominant language
C#
Stars
1k
Forks
312
Avg merge
8h 30m
Merged PRs (30d)
469

Description

Today, TestContext cancellation token (source) can be reused for multiple TestInitialize/TestCleanup calls (on inheritance hierarchy of a test class). This is even being extended in https://github.com/microsoft/testfx/pull/6132 to the new global init/cleanup.

If, during one call, we got cancelled already, what we do today is that we run the remaining steps with the same, already-cancelled token. What is the point of invoking something with an already-cancelled token? We should either:

  • Create a new token for each call.
  • Avoid executing subsequent initializes if we are already cancelled.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start by tracing TestContext cancellation through inherited TestInitialize and TestCleanup calls, including the global initialization and cleanup mentioned in PR 6132. Clarify whether cancellation should create a new token per call or skip subsequent calls, then add focused coverage for the chosen behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.