I am using Visual Studio's built-in Test Explorer (e.g. in VS 2022) to run xUnit tests.
From time to time (and reproducibly so with certain projects), I keep getting stuck at some test cases that will not execute. That is, I select a parent node in Test Explorer, click "Run" to run all tests in the subtree, and the result looks like this:
The results summary for said parent node is displayed like this:
In English, that is:
Tests in group: 14
Total duration: 950msResults
9 not run
2 passed
3 failed
Ok, so the majority of my test cases were "not run" - but why? What does that mean?
When clicking the test cases that were not run, there are no details available for them (i.e. no duration, no output). I presume they did not fail due to an exception, as that would typically be counted as "failed" by xUnit and the exception would be visible in the output.
When I attempt to run just one of the not run cases individually, the "running" indicator icon will be shown for a few moments, then we're back at "not run", as well.
This is not a new phenomenon; I have been observing this behaviour for some two years by now, across multiple versions of Visual Studio on different computers, and also in ReSharper's test UI. If xUnit has decided it will not run a given test, apparently it will not run, no matter what I do.
Lastly, note that the running and not running test cases are in the same solution, even in the same test class file. This is unlike somewhat similar questions where something about the project settings is the issue and all test cases from a given unit test project are not run.