Nimblesite / Nimblesite/SharpLsp

Test Explorer: MSTest tests not discovered (dotnet test --list-tests emits bare DisplayName, not FQN)

Open
#180 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
132
Forks
5
Avg merge
6h 24m
Merged PRs (30d)
27

Description

Summary

The Test Explorer discovers tests by scraping dotnet test --list-tests output (test-discovery.tsparseTestList / isDiscoveredTestLine). That command prints each test's DisplayName, not its FullyQualifiedName. This works for xUnit (whose DisplayName defaults to Namespace.Class.Method) and — after the NUnit.DisplayName=FullName runsettings fix ([TEST-DISCOVERY-NUNIT-FQN]) — for NUnit. MSTest has no such runsettings switch, so its DisplayName stays the bare method name and isDiscoveredTestLine drops it (no .). Result: MSTest tests are not discovered.

Evidence (verified on net10.0, dotnet test --list-tests)

Framework list-tests output Discovered?
xUnit C#/F# Cs.Sample.Tests.CalculatorTests.Adds_TwoNumbers
NUnit C#/F# (with FullName runsettings) Cs.Nunit.Tests.CalcTests.AddsTwoNumbers
MSTest C#/F# AddsTwoNumbers (bare) ❌ dropped

The frameworks e2e suite (test-explorer-frameworks-e2e.test.ts) asserts this current behavior as a regression sentinel.

Fix options (framework-agnostic)

Stop scraping DisplayName text; source TestCase.FullyQualifiedName directly:

  • vstest.console.exe --ListFullyQualifiedTests --ListTestsTargetPath:<file> on the built assemblies, or
  • the VSTest TranslationLayer (VsTestConsoleWrapper.DiscoverTests) reading TestCase.FullyQualifiedName, or
  • a TRX logger and parse FullyQualifiedName from the TRX.

Any of these yields Namespace.Class.Method identically for xUnit, NUnit and MSTest, and would let the NUnit runsettings workaround be removed.

Spec / tracking

  • Spec: docs/specs/TESTING-EXPLORER-SPEC.md §2.4 [TEST-DISCOVERY-NUNIT-FQN], §11 Known limitations.
  • Plan: docs/plans/TESTING-EXPLORER-PLAN.md.

Contributor guide

No contributing guide indexed for this repository

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

Start with test-discovery.ts, especially parseTestList and isDiscoveredTestLine, then read test-explorer-frameworks-e2e.test.ts and the referenced testing explorer spec and plan. Compare the available discovery approaches in the issue and trace how test names reach Test Explorer. Done means MSTest, xUnit, and NUnit tests are discovered by fully qualified name and the regression coverage reflects the corrected behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, typescript
Domain
developer-experience, testing-qa
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.