Skip to content

Enhanced Branch Coverage #67

@hunterjm

Description

@hunterjm

Expected Result

When running code coverage on a project, all branches in a method will be determined, and their targets will be instrumented.

Actual Result

Currently, only sequence points that are targets of branches are instrumented.

Proposed Solution

Implement a branch point/target search using logic similar to OpenCover.Framework.Symbols.CecilSymbolManager. This would allow us to:

  • Track Branches separately from Sequence Points.
  • Instrument all Branch Targets.
  • Provide more detailed branch information to the supported reporters.

Discussion

I've already taken an initial stab at this functionality in my fork and everything seems to be working. I am in the process of cleaning up the code and adding tests, but wanted to open this issue before opening a PR.

Major high-level changes to the structure are as follows:

  • Removed IsBranchTarget from Line and LineInfo as branches are now tracked separately from sequence points.
  • Changed InstrumenterResult
    • Added Branch which extends Line and adds additional properties such as Path
    • Changed Document to have both Lines and Branches
  • Changed CoverageResult
    • Updated Methods to be a Dictionary with a new class Method as the Value
    • Method contains Lines and Branches
  • Changed all supporting code (Instrumenter, CoverageSummary, Reporters) to handle the new model structure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions