FortuneN / FineCodeCoverage

Visualize unit test code coverage easily for free in Visual Studio Community Edition (and other editions too)
https://marketplace.visualstudio.com/items?itemName=FortuneNgwenya.FineCodeCoverage
Other
516 stars 39 forks source link

Tests executed by VS run twice #339

Closed luca-domenichini closed 1 year ago

luca-domenichini commented 1 year ago

Installed product versions

Description

When running tests inside VS with FCC extension installed, tests run twice. The problem seems to belong to the fact that FCC extension copies all dlls in a subfolder of the bin directory, and seems to be related to https://developercommunity.visualstudio.com/t/why-does-my-test-run-twice/609172. VS will find the same dll used for the real test twice, and execute them accordingly. image

Steps to recreate

  1. Run the test "Run_just_me": image
  2. The test should create a new file C:\tmp_test.txt with a single line "test". If FCC extension is not installed, everything works ok.
  3. After installing FCC extension, "Run_just_me" is executed twice, and test "Dont_run_this" is executed as well! image

Note that executing the test using CLI does produce the expected correct behaviour: image image

Current behavior

File "C:\tmp\_test.txt" content have multiple lines, both related to the executing test and to other tests.

Expected behavior

File "C:\tmp\_test.txt" content should have just 1 line related to "Run_just_me" test.

FCCTestProject.zip

tonyhallett commented 1 year ago

This is mentioned on the readme page and there are numerous issues already opened on this matter. Use ms code coverage instead.

luca-domenichini commented 1 year ago

Ok, thank you. Solved by modifying RunMsCodeCoverage to Yes: image