From 225326a4e4eb902bb19ab973e701ce76b763e567 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Thu, 28 May 2026 16:01:35 +0200 Subject: [PATCH] Remove misleading TreeNodeFilter test added by PR #7415 The `LiteralSegment_RequiresWildcardToMatchNodesWithAdditionalSuffix` test was added in PR #7415 to `document a current limitation'' for microsoft/testfx#7300. The premise was incorrect: TUnit (the framework that surfaced the issue) does not append `()'' or any suffix to its test node IDs - its `TestFilterService.BuildPath` emits a clean `/{asm}/{namespace}/{class}/{methodName}` path. Direct reflection probe against Microsoft.Testing.Platform 2.0.2 (the version TUnit currently bundles) confirms `TreeNodeFilter` matches all the patterns from the issue, including `/*/*/*/(MyTest1)`, against `/YourTestProjectNameHere/YourTestProjectNameHere/MyTests/MyTest1`. The remaining cases in #7300 are a pre-filter bug in TUnit's `MetadataFilterMatcher.ExtractFilterHints` (filed upstream as thomhurst/TUnit#6026); MTP behaves correctly. The deleted test asserted `MatchesFilter` returns false for path `/A/B/C/MyTest1()`, which is just standard anchored-regex behaviour already covered by `MatchWildcard_MatchesSubstrings` and unrelated to issue #7300, so its presence (with the misleading comment + issue link) hurts more than it helps. The genuinely useful regression test added by the same PR (`OrExpression_WorksForSinglePathSegmentInsideParentheses`) is kept. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Requests/TreeNodeFilterTests.cs | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/test/UnitTests/Microsoft.Testing.Platform.UnitTests/Requests/TreeNodeFilterTests.cs b/test/UnitTests/Microsoft.Testing.Platform.UnitTests/Requests/TreeNodeFilterTests.cs index 928fb83abc..a5b341f5a1 100644 --- a/test/UnitTests/Microsoft.Testing.Platform.UnitTests/Requests/TreeNodeFilterTests.cs +++ b/test/UnitTests/Microsoft.Testing.Platform.UnitTests/Requests/TreeNodeFilterTests.cs @@ -80,21 +80,6 @@ public void OrExpression_WorksForSinglePathSegmentInsideParentheses() Assert.IsFalse(filter.MatchesFilter("/A/B/C/MyTest3", new PropertyBag())); } - [TestMethod] - public void LiteralSegment_RequiresWildcardToMatchNodesWithAdditionalSuffix() - { - // Note: This documents a current limitation that often surprises users. - // Path segments are matched against an anchored regex (^value$), so a literal - // like 'MyTest1' will NOT match a node whose actual ID is 'MyTest1()' (e.g. when - // a framework appends parameter/method-signature info to the displayed name). - // Users observing this typically need to add a wildcard: '/*/*/*/(MyTest1*|MyTest2*)'. - // See https://github.com/microsoft/testfx/issues/7300 for the user-facing report. - TreeNodeFilter filter = new("/*/*/*/(MyTest1|MyTest2)"); - - Assert.IsFalse(filter.MatchesFilter("/A/B/C/MyTest1()", new PropertyBag())); - Assert.IsFalse(filter.MatchesFilter("/A/B/C/MyTest2()", new PropertyBag())); - } - [TestMethod] public void FullPathOrInsideParenthesizedExpressions_IsNotSupported_ThrowsActionableMessage() {