Repository navigation
Fix duplicate RTD nodes for parameterized fixtures under MTP - #1514
Merged
Merged
Conversation
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>
Contributor
There was a problem hiding this comment.
🟡 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
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fixes #1513
Under MTP, VS real-time discovery showed a duplicate "not run" node for every test in a parameterized fixture.
TestMethodIdentifierProperty.TypeNamecontained the fixture arguments, so it did not match the CLR type VS gets from Roslyn.TypeNameis now the CLR type name, so the nodes merge.TypeNamekeeps the fixture arguments, so the TRXclassNameis unchanged (Test class name missing in TRX report for parametrized fixture when running through MTP #1351).Fixture("A").NoParameter, so the instances stay distinguishable.NUnit.FixtureNametest 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.mdwith 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