Skip to content

Fix duplicate RTD nodes for parameterized fixtures under MTP - #1514

Merged
OsirisTerje merged 4 commits into
mainfrom
issue1513
Oct 21, 2026
Merged

OsirisTerje merged 4 commits into
mainfrom
issue1513

Conversation

@OsirisTerje

@OsirisTerje OsirisTerje commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Fixes #1513

Under MTP, VS real-time discovery showed a duplicate "not run" node for every test in a parameterized fixture. TestMethodIdentifierProperty.TypeName contained the fixture arguments, so it did not match the CLR type VS gets from Roslyn.

  • TypeName is now the CLR type name, so the nodes merge.
  • With a TRX report requested, TypeName keeps the fixture arguments, so the TRX className is unchanged (Test class name missing in TRX report for parametrized fixture when running through MTP #1351).
  • Without TRX, the display name gets the fixture prefix, for example Fixture("A").NoParameter, so the instances stay distinguishable.
  • The fixture comes from NUnit's own data, stored in a new NUnit.FixtureName test property, instead of parsing the test name. This also fixes custom test names with dots and parentheses inside quoted arguments.

MTP uses the same type name both to match tests to source and to group them in Test Explorer, so one node per fixture instance is not possible. The display name is the only field we control.

The behavior change is MTP only. The converters only add the new property, which VSTest ignores. Also adds CLAUDE.md with the build rules for this repo. All 148 acceptance tests pass. Checked manually in VS with 6.4.0-alpha.0.27.

🤖 Generated with Claude Code

OsirisTerje and others added 2 commits October 20, 2026 20:04
VS real-time discovery knows only the CLR type, so TestMethodIdentifierProperty.TypeName
must not contain the fixture arguments. Without a trx report the plain CLR type name is
used, and the fixture arguments move to the display name, e.g. Fixture("A").NoParameter,
so the instances stay apart in Test Explorer.

The bridge builds the trx className from TypeName, so when a trx report is requested
(ITrxReportCapability.Enable) the fixture arguments are kept in TypeName (#1351) and the
display name is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 20, 2026 18:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Fixture extraction mishandles valid custom names and quoted parentheses, producing indistinguishable or incorrect test labels.

1 open issue
What changed in this PR

Fixes MTP real-time discovery matching for parameterized fixtures while preserving existing TRX class names.

Changes:

  • Uses CLR type names when TRX reporting is disabled.
  • Adds fixture arguments to discovery and execution display names.
  • Adds unit and acceptance coverage for both reporting modes.
File Description
src/​NUnitTestAdapterTests/​TestingPlatformAdapter/​TestMethodIdentifierBuilderTests.cs Tests conditional fixture arguments in identifiers.
src/​NUnitTestAdapterTests/​TestingPlatformAdapter/​FixtureDisplayNameTests.cs Tests fixture-prefixed display names.
src/​NUnitTestAdapter/​TestingPlatformAdapter/​TestMethodIdentifierBuilder.cs Selects CLR or fixture-qualified type names.
src/​NUnitTestAdapter/​TestingPlatformAdapter/​TestApplicationBuilderExtensions.cs Tracks TRX reporting state.
src/​NUnitTestAdapter/​TestingPlatformAdapter/​NUnitBridgedTestFramework.cs Integrates identifier and display-name changes.
src/​NUnitTestAdapter/​TestingPlatformAdapter/​FixtureDisplayNameFrameworkHandle.cs Applies display names to execution events.
src/​NUnitTestAdapter/​TestingPlatformAdapter/​FixtureDisplayNameDiscoverySink.cs Applies display names during discovery.
src/​NUnitTestAdapter/​TestingPlatformAdapter/​FixtureDisplayName.cs Builds fixture-prefixed labels without TRX.
src/​NUnit.TestAdapter.Tests.Acceptance/​Issue1513Tests.cs Verifies identifiers, labels, and TRX output.

Review effort: Balanced

OsirisTerje and others added 2 commits October 20, 2026 21:05
The display-name prefix and the TRX type name were derived by splitting the
test's full name at the last dot outside parentheses. That fails for custom
test names with dots and for quoted parentheses in arguments, and it gave
plain fixtures with dotted test names a wrong prefix.

The converters now store the full name of the enclosing NUnit fixture in a
new NUnit.FixtureName test property, and the MTP code uses that. Adds
CLAUDE.md with the build rules for this repo.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The workspace folder used test.Name, which includes the full type name of
the test source argument. On the windows runner image with MSBuild 18.11,
satellite resource files under bin\Debug\<tfm>\pt-BR pushed the longest
SetUpFixture and TestFixture workspaces past 260 characters (MSB3021).
CreateMutexDirectory already adds a number suffix for repeated names.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@OsirisTerje
OsirisTerje merged commit 45f6a74 into main Oct 21, 2026
3 checks passed
@OsirisTerje
OsirisTerje deleted the issue1513 branch October 21, 2026 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NUnit3TestAdapter 6.3.1: [TestCase] with enum parameter appears twice in Visual Studio Test Explorer (MTP)

2 participants