问题
I've just installed Visual Studio 2019 Professional and I noticed some misbehavior if I compare it to the VS 2017 which I used to work with.
The Test Explorer window
In the VS 2017 when I open a project, that already had been opened previously, I see all the tests in the Test Explorer. In the VS 2019 the window is empty until I rebuild the solution.
If I rebuild the solution and all the xUnit tests are discovered I cannot click on any single test. I can click on all the folders in the hierarchy, but not on the leaf node with the actual test - so I don't see the exception if the test fails or any further details. If I right-click on the test, the possibility Open Test is always disabled.
In VS 2017 the same solution is working fine without any changes.
回答1:
By updating the VS the problem disappeared. I am currently running the VS 2019 Pro 16.3.6.
回答2:
I had a similar issue,
current workaround :
- close all visual studio instances
- delete .vs folder at project root
- reopen the sln
- rebuild
- use test explorer to run tests
Reported issue
回答3:
I had both VS 2017 and VS 2019 installed when I had this issue. Tests worked fine in 2017 but not in 2019. I uninstalled 2017 as it worked for others in my team who just had 2019. As soon as I uninstalled 2017 and did a restart the tests started working for me again.
来源:https://stackoverflow.com/questions/56682824/visual-studio-2019-test-explorer-not-working-well-with-xunit