Giter VIP home page Giter VIP logo

Comments (11)

danielpalme avatar danielpalme commented on May 18, 2024

Your XML contains this information about branches:

<BranchPoints>
  <BranchPoint vc="2" uspid="108875" ordinal="0" offset="56" sl="23" path="0" offsetend="58" fileid="3073" />
  <BranchPoint vc="2" uspid="108876" ordinal="1" offset="56" sl="23" path="1" offsetend="69" fileid="3073" />
</BranchPoints>

This seems to be correct. And then the HTML report will show 2 of 2 branches covered.
I created a similar class and I get 2 branches with both are shown as covered in the report.

Do you pass a single coverage report to ReportGenerator or several files?

from reportgenerator.

CookieNick avatar CookieNick commented on May 18, 2024

Thanks for your amazingly fast response.

I have a batch file which executes the coverage, which just uses one results.xml. The line of code which executes the Report Generator is this;

..\packages\ReportGenerator.2.1.3.0\reportgenerator.exe -reports:results.xml -targetdir:CoverageReport

I do execute three unit test projects through OpenCover (which calls mstest with three testcontainer arguments). To be sure, I've checked the file id's, but there's only one file with id '3073' as in the example.

from reportgenerator.

danielpalme avatar danielpalme commented on May 18, 2024

Could you provide the full results.xml?

from reportgenerator.

danielpalme avatar danielpalme commented on May 18, 2024

I took a look at the results.xml you have sent me.
I think I found the reason why you get strange results.

Each of your unit test assemblies use a separate copy of the X.BusinessLayer.dll.
The X.BusinessLayer.dll is referenced 4 times. One test assembly covers the two branches the others don't cover the relevant code.
ReportGenerator groups the assemblies by their name and then shows 2 of 8 branches as covered.

To fix this issue try using the following option when executing OpenCover: -mergebyhash

https://github.com/OpenCover/opencover/wiki/Usage#optional-arguments

Please let me know if this helps.

from reportgenerator.

CookieNick avatar CookieNick commented on May 18, 2024

Yes, this helps. My issue is resolved. Thanks a lot for your outstanding support!

from reportgenerator.

jrnail23 avatar jrnail23 commented on May 18, 2024

@danielpalme, I think I have a similar problem, but OpenCover's -mergebyhash isn't working for me.
The OpenCover XML is reporting significantly different numbers than I'm getting from ReportGenerator.

I'd be happy to send along my files for troubleshooting.

from reportgenerator.

danielpalme avatar danielpalme commented on May 18, 2024

Please send me your OpenCover file.
And (if possible) a class file, where you think something is wrong.

from reportgenerator.

jrnail23 avatar jrnail23 commented on May 18, 2024

@danielpalme, I'll be sending you my file soon.
Specifically, I'm not sure if my branch point data is inaccurate, but ReportGenerator says I have 1897 classes and 56.7% branch coverage, while my OpenCover output says I have 2443 classes (1549 visited) and 60.63% branch coverage.

from reportgenerator.

jrnail23 avatar jrnail23 commented on May 18, 2024

@danielpalme, just realized I should tell you I emailed my file to you, in case it gets caught in your spam filters 😄

from reportgenerator.

danielpalme avatar danielpalme commented on May 18, 2024

I received your files. I will look into them within the next days.

This wiki page explains some metrics of ReportGenerator: https://github.com/danielpalme/ReportGenerator/wiki/Calculation-details

from reportgenerator.

jrnail23 avatar jrnail23 commented on May 18, 2024

Thanks, I appreciate the help!

from reportgenerator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.