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
NUnit3TestAdapter 6.3.1: [TestCase] with enum parameter appears twice in Visual Studio Test Explorer (MTP) #1513
In our real solution the tests that duplicate all take a nested enum as [TestCase] parameter (inside a
parameterized [TestFixture] with a primary constructor). Tests without parameters, and parameterized
fixtures without [TestCase] parameters, are not duplicated.
Observed in our real solution
The entry created at execution time has a different name than the discovered one:
Executed: ProcessWorkflowAutoStarter(Execution.Tests.ExecutionProcessWithTestOrderServerTest+WorkFlowAutoStarterTestCase)
(fully qualified type name of the parameter, nested type separated by +)
The discovered entries stay "not run". Deleting .vs\<solution>\v18\TestStore and restarting shows the correct
count until the first build, then the duplicates return.
Microsoft.Testing.Platform itself discovers the correct number of tests: <exe> --list-tests and dotnet test
report each test case once and all pass.
Turn off the Real Time Test Discovery (RTD), those nodes that are not run, are ghost nodes from the RTD. It's Microsoft's attempt of figuring out the test cases before anything is run, it doesn't always match.
I agree it is a bit strange that NoParameter seems to exist as identical doubles. Also I see that the not-run node has source info added, but the node that run don't , so that is a bit strange. They must somehow be different.
@Evangelink This looks a lot like the same bug as in #1504 . You mentioned something about other possible cases. Can this be in the same league? And can we fix it in the adapter ?
The source code link comes from the RTD, MTP suppress it for test results. Further MTP doesn't understand the NUnit format (and I don't think they ever will fully support the NUnit format), since they have bound themselves to the C# FQN, but NUnit expands that by having parameters on fixtures.
We will see if we can merge the two together, but the test explorer will then not show the nodes the same way.
I believe if you skip MTP this would work better.
But @Evangelink will not like me anymore if I don't do anything here, so..... here we go !
We are constrained by MTP because it uses the same field, TestMethodIdentifierProperty.TypeName, both to match tests to source code and to build the Test Explorer hierarchy, and MTP has no separate property for display grouping. If the fixture arguments are in that field, real-time discovery cannot match the nodes and shows duplicates; if they are left out, all fixture instances fall under one class node.
We can only change the leaf node, the name of the test itself, and that is what we have done here.
The options above could also be added as runsettings options.
Just to show the first attempt, resulting in all under one node:
Sorry for the delay @OsirisTerje! I was OOF sick all past week and just resuming now. Please let me know if you want me to have a look at something (including expanding something on MTP).
Right now I think I have a sort of control. I'm reverse enginering what you do other places (aka MSTest), and of course MTP itself, so I do manage to get the information I need.
But I will ping you when something needs to be clarified.
I have been focusing lately on the FQNIssues, they are overdue, and checking them against both VSTest and MTP. Currently I need more information from the Test Explorer, so creating a tool for extracting that information using Windows Automation. That way I can use Claude to also "see" what Test Explorer do. That will also help when I later now work through all the MTP issues. That is also overdue.
The FQNIssues parent epic was created way back (2018) by @peterwald , #505 and show all issues we have with that.
Activity
OsirisTerje commentedon Oct 20, 2026
Turn off the Real Time Test Discovery (RTD), those nodes that are not run, are ghost nodes from the RTD. It's Microsoft's attempt of figuring out the test cases before anything is run, it doesn't always match.
I agree it is a bit strange that NoParameter seems to exist as identical doubles. Also I see that the not-run node has source info added, but the node that run don't , so that is a bit strange. They must somehow be different.
We have to look into this. Thanks for the repro!
OsirisTerje commentedon Oct 20, 2026
@Evangelink This looks a lot like the same bug as in #1504 . You mentioned something about other possible cases. Can this be in the same league? And can we fix it in the adapter ?
OsirisTerje commentedon Oct 20, 2026
The source code link comes from the RTD, MTP suppress it for test results. Further MTP doesn't understand the NUnit format (and I don't think they ever will fully support the NUnit format), since they have bound themselves to the C# FQN, but NUnit expands that by having parameters on fixtures.
We will see if we can merge the two together, but the test explorer will then not show the nodes the same way.
I believe if you skip MTP this would work better.
But @Evangelink will not like me anymore if I don't do anything here, so..... here we go !
OsirisTerje commentedon Oct 20, 2026
@tom-englert
We can tweak it for MTP to something like this:
Further, we can tweak the format a bit, like for these options:
ParameterizedFixtureWithNestedEnumTests(A).NoParameter(A).NoParameterNoParameter [A]We are constrained by MTP because it uses the same field, TestMethodIdentifierProperty.TypeName, both to match tests to source code and to build the Test Explorer hierarchy, and MTP has no separate property for display grouping. If the fixture arguments are in that field, real-time discovery cannot match the nodes and shows duplicates; if they are left out, all fixture instances fall under one class node.
We can only change the leaf node, the name of the test itself, and that is what we have done here.
The options above could also be added as runsettings options.
Just to show the first attempt, resulting in all under one node:
Is this helping, @tom-englert ?
Use NUnit's fixture name instead of parsing the test name (#1513)
Fix duplicate RTD nodes for parameterized fixtures under MTP (#1514)
OsirisTerje commentedon Oct 21, 2026
@tom-englert You can check this out using the Myget package, version 6.4.0-alpha.0.25, see https://docs.nunit.org/articles/nunit/getting-started/downloading.html#developer-versions for how to set it up.
Please confirm it works for you.
tom-englert commentedon Oct 22, 2026
@OsirisTerje I can confirm that 6.4.0-alpha.0.25 fixes the issue. Thanks!
Evangelink commentedon Oct 26, 2026
Sorry for the delay @OsirisTerje! I was OOF sick all past week and just resuming now. Please let me know if you want me to have a look at something (including expanding something on MTP).
OsirisTerje commentedon Oct 26, 2026
Thanks @Evangelink !
Right now I think I have a sort of control. I'm reverse enginering what you do other places (aka MSTest), and of course MTP itself, so I do manage to get the information I need.
But I will ping you when something needs to be clarified.
I have been focusing lately on the FQNIssues, they are overdue, and checking them against both VSTest and MTP. Currently I need more information from the Test Explorer, so creating a tool for extracting that information using Windows Automation. That way I can use Claude to also "see" what Test Explorer do. That will also help when I later now work through all the MTP issues. That is also overdue.
The FQNIssues parent epic was created way back (2018) by @peterwald , #505 and show all issues we have with that.