You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
--where / SelectWhere: whitespace inside a quoted test == value is stripped in 3.22.0, so tests whose names contain a space are no longer selected #1927
Starting with NUnit Engine 3.22.0, the selection-expression parser removes whitespace that appears outside double quotes within a single-quoted value. The resulting filter no longer matches the test's full name, and the test is silently skipped. No error or warning is reported. 3.18.1 keeps the value verbatim.
This affects names NUnit generates itself. A ValueTuple argument is displayed as (A, B), with a space after the comma. Names set via SetName("{m} (Case 1)") are affected too. Spaces inside a string argument ("a b") are kept.
test == 'Repro.TupleOnly.Tuple((PROJECT, GLOBAL))'
-> <filter><test>Repro.TupleOnly.Tuple((PROJECT, GLOBAL))</test></filter>
test == 'Repro.Shapes.StringArg("a b")'
-> <filter><test>Repro.Shapes.StringArg("a b")</test></filter>
test == 'Repro.Shapes.SpaceBeforeParen (Case 1)'
-> <filter><test>Repro.Shapes.SpaceBeforeParen (Case 1)</test></filter>
NUnit.Engine 3.22.0 (actual):
test == 'Repro.TupleOnly.Tuple((PROJECT, GLOBAL))'
-> <filter><test>Repro.TupleOnly.Tuple((PROJECT,GLOBAL))</test></filter>
test == 'Repro.Shapes.StringArg("a b")'
-> <filter><test>Repro.Shapes.StringArg("a b")</test></filter>
test == 'Repro.Shapes.SpaceBeforeParen (Case 1)'
-> <filter><test>Repro.Shapes.SpaceBeforeParen(Case1)</test></filter>
End-to-end impact
NUnit3TestAdapter 6.x ships engine 3.22.0 and passes runsettings <NUnit><Where> through SelectWhere. With a <Where> listing such tests, adapter 5.1.0 (engine 3.18.1) runs all of them, while 6.3.1 and current main skip them. Swapping only the engine DLLs in a 5.1.0 output to 3.22.0 reproduces the skip, which points to the engine rather than the adapter.
Test
3.18.1
3.22.0
Tuple((PROJECT, GLOBAL)) (ValueTuple via TestCaseSource)
runs
skipped
SpaceBeforeParen (Case 1) (SetName)
runs
skipped
StringArg("a b")
runs
runs
TwoEnums(PROJECT,GLOBAL)
runs
runs
Environment: .NET 10, NUnit 4.6.1, macOS arm64. The repro also affects Linux CI.
@CharliePoole, @stryczekk, confirmed on the current v4 engine source at 3af18b3, under both Windows .NET 10 and .NET Framework 4.6.2. The production engine source used for this probe is unchanged from that upstream commit.
Using the public ITestEngine / ITestFilterService path, SelectWhere produces the reported results:
A no-space TwoEnums(PROJECT,GLOBAL) control remains unchanged.
Passing the same four names through AddTest preserves every name verbatim on both runtimes. This confirmation covers filter construction and the emitted XML, without involving an adapter or executing test assemblies.
The source explains the difference: Tokenizer retains the quoted string, but TestSelectionParser.GetTestName then skips literal spaces outside nested double quotes in its TokenKind.String branch. That normalizes an already quoted literal before it is emitted as the test filter.
I suggest regression cases at both the parser and public filter-builder boundary for tuple names and custom names containing spaces, while retaining the existing escaped-quote and unquoted-name compatibility cases.
Prepared by Neil Colvin with assistance from OpenAI Codex.
Thanks @oznetmaster, confirmed now for both branches.
@nunit/engine-team Looking for someone to take this on for 3.22.1. I didn't mark it critical (immediate release needed) but it does seem to be quite serious and is affecting the adapter as well. We'll want to migrate the fix to V4 as well.
@CharliePoole, I can take this for 3.22.1, then port the fix to v4. I will keep it separate from the remote-provider work.
I will add regressions at the parser and public filter-builder boundary for the reported tuple/custom names, preserve the existing escaped-quote and unquoted-name compatibility coverage, and verify the same expected filter values on both branches. The existing reproduction through the public API gives us a small starting point without an adapter-specific workaround.
Prepared by Neil Colvin with assistance from OpenAI Codex.
Activity
CharliePoole commentedon Oct 26, 2026
@nunit/engine-team @stryczekk The Needs Confirmation applies only to the current V4 build.
oznetmaster commentedon Oct 26, 2026
@CharliePoole, @stryczekk, confirmed on the current v4 engine source at 3af18b3, under both Windows .NET 10 and .NET Framework 4.6.2. The production engine source used for this probe is unchanged from that upstream commit.
Using the public ITestEngine / ITestFilterService path, SelectWhere produces the reported results:
Passing the same four names through AddTest preserves every name verbatim on both runtimes. This confirmation covers filter construction and the emitted XML, without involving an adapter or executing test assemblies.
The source explains the difference: Tokenizer retains the quoted string, but TestSelectionParser.GetTestName then skips literal spaces outside nested double quotes in its TokenKind.String branch. That normalizes an already quoted literal before it is emitted as the test filter.
https://github.com/nunit/nunit-console/blob/3af18b34bc32a349ce9dd649fbd09714dbc7ff4f/src/NUnitEngine/nunit.engine/Services/TestSelectionParser.cs
I suggest regression cases at both the parser and public filter-builder boundary for tuple names and custom names containing spaces, while retaining the existing escaped-quote and unquoted-name compatibility cases.
Prepared by Neil Colvin with assistance from OpenAI Codex.
CharliePoole commentedon Oct 26, 2026
Thanks @oznetmaster, confirmed now for both branches.
@nunit/engine-team Looking for someone to take this on for 3.22.1. I didn't mark it critical (immediate release needed) but it does seem to be quite serious and is affecting the adapter as well. We'll want to migrate the fix to V4 as well.
oznetmaster commentedon Oct 26, 2026
@CharliePoole, I can take this for 3.22.1, then port the fix to v4. I will keep it separate from the remote-provider work.
I will add regressions at the parser and public filter-builder boundary for the reported tuple/custom names, preserve the existing escaped-quote and unquoted-name compatibility coverage, and verify the same expected filter values on both branches. The existing reproduction through the public API gives us a small starting point without an adapter-specific workaround.
Prepared by Neil Colvin with assistance from OpenAI Codex.
Preserve whitespace in quoted test-selection values
Preserve whitespace in quoted test-selection values
CharliePoole commentedon Nov 24, 2026
This issue has been resolved in version 3.23.0
The release is available on:
GitHub.
NuGet packages are also available NuGet.org and
Chocolatey Packages may be found at Chocolatey.org