Visual Studio 2019 Test Explorer not working well with xUnit

Viewed 4003

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

  1. 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.

  2. 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.

enter image description here

In VS 2017 the same solution is working fine without any changes.

3 Answers

I had a similar issue,

current workaround :

  1. close all visual studio instances
  2. delete .vs folder at project root
  3. reopen the sln
  4. rebuild
  5. use test explorer to run tests

Reported issue

By updating the VS the problem disappeared. I am currently running the VS 2019 Pro 16.3.6.

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.

Related