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
506 stars 38 forks source link

RunSettingsFilePath in csproj #312

Open Soundman32 opened 1 year ago

Soundman32 commented 1 year ago

Installed product versions

Description

Every csproj file gets a local path based RunSettingsFilePath, which ends up getting checked into git and breaks the build.

Steps to recreate

Open solution, build and run tests.

Current behavior

This gets added to every csproj: <RunSettingsFilePath>C:\dev\MyProjectetc\bin\Debug\net6.0\fine-code-coverage\coverage-tool-output\MyProject.UnitTests-fcc-mscodecoverage-generated.runsettings</RunSettingsFilePath>

Expected behavior

csproj files should not be modified when testing.

tonyhallett commented 1 year ago

When FCC generates the runsettings it is necessary to write to the proj file. FCC does attempt to remove this element.

It is possible to supply your own runsettings. Alternatively you can use Coverlet / OpenCover coverage instead of ms code coverage which does not adjust the csproj file.

Soundman32 commented 1 year ago

I'd forgotten I'd enabled the ms code coverage thing. I've turned it off and it now works without updating the csproj.

tonyhallett commented 1 year ago

There is a difference between ms and 'old style' though. Ms is immediate and collects from the tests you select. Old style runs all tests after the ones you select finish.

I will look at storing the csproj and overwriting with it instead.

UkeHa commented 1 year ago

@tonyhallett, it should use a relative path instead of an absolute one. That way the files can be pushed to git and shared between developers. the autogenerated config should search from the base path of the project with the option to enter an absolute path.

tonyhallett commented 1 year ago

@UkeHa The generated runsettings entry in the csproj file should be deleted. If this was occurring then it would be irrelevant. If someone could specify when it doesn't then I could look at it. Note that this does not happen every time.

https://github.com/FortuneN/FineCodeCoverage/assets/11292998/1405b6eb-f9fa-4513-9976-16f249a9de36

The generated runsettings is generated in your bin folder which is not checked in.

adamhearn commented 3 months ago

@tonyhallett I can see that for the most part the csproj amendment is removed at the end of the test run.

However, I think there must be an edge case somewhere as it does occasionally get left behind - I've seen this a few times across different projects.

As an aside if a test fails (I just threw an exception in there) the setting is not removed (it did get removed once the test passes).