mstestopencoverreportgenerator

What does Total lines constitute in ReportGenerator?


I'm using the opensource tool ReportGenerator to show the details of the XML output generated from using OpenCover and mstest. For one particular project I see the following metrics:

Ok, Covered + Uncovered = Coverable lines and this makes sense. However Total lines is significantly above this value and I want to know what constitutes or defines all these additional lines of code to make up Total lines.

The documentation for ReportGenerator is sparse at best, but I would guess it encompasses commenting, whitespace, things like using statements (for importing namespaces), declarations of methods, classes, etc. that are not testable. However I'm not sure, and I plan on using this tool for a lot of projects and need to be able to explain what's behind this number.

Does anyone know or can explain what the Total lines value is comprised of beyond the total testable lines?


Solution

  • According to Codefile.cs it is

    string[] lines = System.IO.File.ReadAllLines(this.Path); 
    this.TotalLines = lines.Length; 
    

    and then these are aggregated at the class/assembly level

    However if they are based on files recorded in the PDB then it will not be all your source files there are no sequence points (i.e. a place you can put a break point) that require the file to be recorded in the PDB.