-
-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fine Code Coverage shows coverage of 0% after enable a third pard library #464
Comments
Perhaps you could provide some information so we can determine the nature of the problem. I am going to guess that you have not set the option RunMsCodeCoverage to Yes. If you do not do this then FCC copies dlls changing paths which can result in tests that dependend on paths to fail and the result will be 0% coverage. |
Hi Tony, Thanks for your quick response. The RunMsCodeCoverage is set to False. What exact information do you want? |
Switch to RunMsCodeCoverage Yes then if it is still not providing coverage then provide information as per the side notes in the issue template. |
Setting the switch on RunMsCodeCoverage to Yes is solving the problem. However I can only generate the report only once. In the coverage log is seems to stuk on Ms code coverage as showd in the attachted screenshot. FCC output shows the following lines: Fine Code Coverage 08/11/2024 12:29:24: Ms code coverage |
Is the FCC output referring to the same run as the last in the image that is stuck on Generating html report ? Also DONE occurs after the report has been generated successfully and the new report is shown. Aside from what you see in the screenshot what makes you think that you can only generate the report only once ? |
Yes it is the same run. Fine Code Coverage 08/11/2024 16:23:18: Ms code coverage After Visual Studio is restarted, Fine Code Coverage start to generate the code coverage report correctly |
There is no report as there is no coverage. If you had a coverage report before using MsCodeCoverage then you have changed something. What did you change ? There is no coverage as nothing has been included. Set the option IncludeReferencedProjects to true. If this does not work then you need to provide a repo that I can look at. |
I didn't change anything in my code. The only thing I changed was, after the changing the setting RunMsCodeCoverage to Yes and Visual Studio restarted. After the restart the Code Coverage report is generated. The second time, if I execute the unit tests in Visual Studio, the previously generated report disappeared but no report is generated after that. |
Have you set IncludeReferencedProjects and re-run your tests ? |
Yes. You do have your SUT in a separate project ? |
Yes my SUT is a seperate project from the tests. |
If you are getting no coverage with those settings then you need to show your solution or create a repro. |
I will do. But I can't create a repro with the external library for you because it is confidential. But the issue about the RunMsCodeCoverage to Yes which I mentioned today I can create a repro for you. That's no problem. I will contact again when the repro is available. Thanks for you time for now. |
Do you get the same problem with a different solution ? |
Yes, it's very simple to reproduce the issue after RunMsCodeCoverage is set to true? |
If this behaviour is present for all solutions then it suggests that visual studio has changed something we rely on, which could be a massive issue. What programming language are you using ? |
Sorry for my late reaction. I have created a public repository where you can reproduce the issue. After set RunMsCodeCoverage to the value true, no code coverage is generated after the test running more than once. |
Thanks, as expected no issues with my version of Visual Studio What version of Visual Studio Professional do you have ? |
Updating my visual studio, will check tomorrow. |
Works with I do not have Visual Studio Profesional so the only way to proceed is for you to fork the extension and debug through yourself. Are you willing to do that if I provide instructions ? |
Sorry, at this moment i don't have time to debug the extension for you. However this problem can also be reproduced with the Community Edition of Visual Studio |
With https://github.com/marcelbeekercgm/SampleCoverageProject.git RunMsCodeCoverage Yes and IncludeReferencedProjects cobertura present after the first run and not the second ? Please ensure that if you have muliple installs of Visual Studio they have the same version of FCC installed. After running the first test open ...\SampleCoverageProject-master\SampleCoverageProject-master\SampleCoverageProject.Test\bin\Debug\net8.0\fine-code-coverage\coverage-tool-output it should look like One the second run the directory should be emptied and files generated again. |
I am now getting the behaviour you see. I can see why, FCC generates .runsettings. When it works initially
When it does not
Will let you know when I have determined the cause. |
In the mean time for your original test of the third party library you can include it with a finecodecoverage-settings.xml |
The problem was that Visual Studio was intermittently ( for me, once in many test runs ) returning null for https://learn.microsoft.com/en-us/dotnet/api/vslangproj.reference.path?view=visualstudiosdk-2022 This has been fixed but the fix is only available in releases, vsix, untill @FortuneN resolves the Github Actions issue |
Sorry for my late answer. Can you give an indication whether a new version of the extension becomes available? Thanks in advance. |
Installed product versions
Description
After invoking a method of a third party library there is 0% code coverage using coverlet.
When I generate a code coverage report using dotnet test --collect:"XPlat Code Coverage" and the report generator there is a code coverage report. So I guess the problem is in de fine code coverage extension.
Steps to recreate
Current behavior
Coverage of 0% in all methods
Expected behavior
Coverage of 50%
Side Notes
https://github.com/FortuneN/FineCodeCoverage/stargazers
https://paypal.me/FortuneNgwenya (Once) OR https://liberapay.com/FortuneN/donate (Recurring)
https://marketplace.visualstudio.com/items?itemName=FortuneNgwenya.FineCodeCoverage&ssr=false#review-details
The text was updated successfully, but these errors were encountered: