xunit / xunit/visualstudio.xunit

In vstest mode the xunit test projects keep running, even after testhost is closed

Open
#447 20 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

External
Dominant language
C#
Stars
164
Forks
79
PR merge metrics
No merged PRs in 30d

Description

Repro steps

This can be for example tested on https://github.com/microsoft/vs-streamjsonrpc, by forcing vstest mode in the test project:

<DisableTestingPlatformServerCapability>true</DisableTestingPlatformServerCapability>
<TestingPlatformDotnetTestSupport>false</TestingPlatformDotnetTestSupport>
<UseMicrosoftTestingPlatformRunner>false</UseMicrosoftTestingPlatformRunner>

If a user triggers a run in test explorer and then stops it mid-run, the test runner does not finish running it immediately.
It keeps running until completion. This causes file locking issues to appear.

Expected

vstest and testhosts pass in the parentprocessid, so that the child process closes immediately as soon as the parent closes.
if xunit test process would similarly pass in the parent process id, it could also detect parent closing and close immediately.

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

Reproduce the issue in the vstest-mode configuration against the linked vs-streamjsonrpc example, then trace how the xunit test process is started after testhost receives the parent process ID. Verify that stopping the run causes the child process to exit promptly and releases its file locks, including when the parent process closes unexpectedly.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.