formulahendry / formulahendry/vscode-dotnet-test-explorer
Debugging a single test launches testhost for all test projects in the solution
- Dominant language
- TypeScript
- Stars
- 208
- Forks
- 93
- PR merge metrics
- No merged PRs in 30d
Description
.NET SDK: 6.0.101
Test framework versions:
Microsoft.NET.Test.Sdk: 16.11.0
NUnit: 3.13.2
NUnit3TestAdapter: 4.1.0
Specflow.NUnit: 3.9.40
My solution currently has 3 projects:
1 MVC app project (being tested)
1 Standard unit test project (where I'm running/debugging tests)
1 Functional test project (separate csproj in the same solution)
When I right click and debug a single test in project explorer, it starts up and waits for the debugger to attach as usual, and I'm able to do so fine, except it seems that it launches a separate testhost.exe process for each test project (even though I'm only debugging a single test).
This causes a few problems:
1. When attaching to the testhost project, I have to be careful to attach to the correct one (less a problem, more an inconvenience)
2. When the I finish debugging the test (either by detaching from the process, or just running it to completion), the second testhost process is not stopped. This causes VSCode to think the test runner is still going (because it technically is), which results in a host of issues small and large (various UI things still showing tests running, can't actually run/debug tests again because tests are already running). You have to stop the second testhost instance (either attach and run it through, or kill from command line) before you can run tests again.
Example output (square brackets are my notes, not actual output):
Executing dotnet test --no-build --logger "trx;LogFileName=C:\Path\To\Log\File\0.trx" --filter "FullyQualifiedName=Path.To.Test" in c:/testfolder
Process 46340 started
[at this point I've attached to one of the processes and start debugging the test, eventually running it to completion]
Waiting for debugger to attach
Waiting for debugger to attach
Waiting for debugger to attach
Waiting for debugger to attach
[repeat endlessly until I try to run tests again]
Tests already running, ignore request to run tests for Path.ToTest
Waiting for debugger to attach
Waiting for debugger to attach
Waiting for debugger to attach
[here is where I do a pskill testhost.exe]
Debugger finished
Process 46340 finished
Interesting thing to note, it seems that both testhost instances may be within the same process, as the output only ever outputs the one process PID that was started.
Once the process is killed, UI returns to normal and I'm able to run tests again.
Expected: Debugging should only launch one testhost.exe instance for the project that contains the test being debugged.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.