Open yaakov-h opened 6 years ago
These are issues with the new source based discovery, and how it discovers tests. We need changes both there and in the adapter to align how tests are named. Until then, this issue is blocked.
Is there an issue for the VS side that I can track?
Not yet, but I have mailed the PG about this, and expect them to comment here. You can add to Developer Community if you like, the more the better, and link back to this one too.
Yes we are aware of this issue with SetName attribute. Anytime the name of a test is changed dynamically ( i.e. requires code to be run) source based discovered copy of that test will not match the test object returned by the NUnit test framework. This happens because VS depends on Fully Qualified Name to dedupe them and if the testcase name has changed then FQN also changes. We are in the process of standardizing the FQN and are in touch with NUnit folks to get that implemented. So I really hope that we can get issues like these resolved soon. @peterwald - FYI
I've been running into this as well.
Just so I understand, SetName (or the upcoming SetArgDisplayNames) will still control the display name in test explorer after the FQN work, right?
Yes, it will. The FQN will be added as an additional element and used by the real time discovery
In the process of converting a PCL library to netstandard I have noticed that instead of almost 200 tests I now only have 110 tests of which some are run and some are not. This is due to alot of parameterized tests using SetName I think. This was working fine before I converted to netstandard though so seeing this issue I wonder why it was working before.
If interested this is the repo: https://github.com/Barsonax/Pathfindax. The develop branch is still on PCL and the DotnetStandard has been converted to netstandard. Tested this with Pathfindax and Pathfindax.Test (just unload all other projects).
Any news?
It's still there 16.0.3
@vchirikov @amakhno I believe its better to switch to xunit. Not sure if this is ever getting fixed.
Ping'ed MS about this right now. If the spec is ready we could proceed with fixing this.
This issue has the same underlying cause as #622 and is resolved by PR https://github.com/nunit/nunit3-vs-adapter/pull/668
@johnmwright The #668 fix doesn't seem to fix this one.
Can you take a quick look ?
In Visual Studio 15.6 (with real-time test discovery), the Visual Studio Test Explorer shows tests that do not exist, or tests with sources. In both cases, the tests cannot be run via the Test Explorer.
For example, in Visual Studio Enterprise v15.6.3 with NUnit Adapter 3.10.0.21 and NUnit Framework 3.10.1, and the following code that targets .NET Framework:
After opening the solution, the Test Explorer "discovers" tests including
{m}
as a literal:After building the solution it runs through the test case sources and shows the proper test names, but does not discard the incorrectly discovered ones that are not actually valid tests:
After running all tests, not all tests were run:
Attempting to select one of the last two tests and running it just yields no result, and a fairly useless messages in the Tests Output window: