testfx
testfx copied to clipboard
After upgrade from 2.2.3 to 2.2.5 and later - failed to discover tests in class
Hi after upgrading some project to the latest version (2.2.8) we start to notice many tests were failing to be discovered (almost 50% are failing).
After further investigate I tried many versions of TestAdapter and found that the problem start when trying to move from 2.2.3 (working version) to 2.2.4 (breaks).
I understand that 2.2.4 is deprecated, but I tried all other versions after that and the same issue exists.
Im not too sure what to provide as a repro project since it seems to occur only because of the version upgrade and can't share our source code.
this is the error i get: MSTestAdapter failed to discover tests in class 'BlablaTests' of assembly 'C:...s\bin\Debug\net48\Core.Wpf.UnitTests.dll' because Object reference not set to an instance of an object..
Here is the test log file if it may help logs.host.21-12-03_15-33-38_85307_24 (1).txt
We were seeing similar test discovery issues on v2.2.5+. For us, we had a missing top-level namespace --- i.e., some source files for the test assembly had a top-level namespace and some didn't. Ensuring that all the source files for the test assembly had an explicit top-level namespace made the discovery issue to go away on v2.2.5+ for us.
Yes! Thanks that was it.
Some of my unit tests projects had no default namespace defined. After entering one the problem was gone.
I guess this should be fixed as it is very annoying and a bit hard to notice that some unit tests have gone missing...
This is not linked to the test ID generation but was linked to a bug in hierarchy processing. Updating our object model dependency fixed the issue.
I will close the issue and confirm fix will be included in v3.