10

This seems to be new in VS2019. Sometimes passed tests show with a "white check on green background" circle, but sometimes the colors are inverted. The same applies to the failed test and not-run test icons. What is the significance here?

enter image description here

JamesFaix
  • 8,050
  • 9
  • 37
  • 73
  • 1
    The whitened icons indicate that those test cases were not executed in the latest run, so their status was not updated and might not reflect the truth. – Lex Li Apr 13 '20 at 13:50
  • 2
    Can i force all of them to run. I just want the truth. :) – JamesFaix Apr 14 '20 at 14:22

2 Answers2

7

The green and white check means that the last time the test ran, it succeeded, but was not evaluated on the latest test run.

If you're mysteriously having some of your tests not run, check the Output window, and set Show output from: to Tests. I was having a bunch of unit tests not run and give no indication of why. In my case the issue was Method Trace.Assert failed but inside a Finalizer which does not cause any tests to fail when using NUnit, but does prevent any more tests from running. The output window was the only way to figure this out.

NUnit does not fail on exception in Finalizer

0

Faded-out test results indicate that the test was not a part of the latest Live Unit Test run. Tests only run when a change to the test or the test's dependencies is detected. If there is no change, it avoids unnecessarily running the test. In this case, the grayed out test result is still "up-to-date" though it was not a part of the latest run.

So, you always get the truth. It is as good as you've run those tests. Results for the tests won't change even if you run them again.

Requesting you to go ahead and make a change to one of the tests and check if it runs. Please do let us know.

https://learn.microsoft.com/en-us/visualstudio/test/live-unit-testing?view=vs-2019

Shridhar R Kulkarni
  • 6,653
  • 3
  • 37
  • 57
  • I tested this by having a method always throw an exception, building the solution, then testing. It failed to update the test as failing until I explicitly told it to run the test. – Leon Frickenschmidt Sep 19 '20 at 01:58