Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileCoverage ¶
type FileCoverage struct {
Path string `json:"path"`
TotalLines int `json:"total_lines"`
CoveredLines int `json:"covered_lines"`
CoverageRate float64 `json:"coverage_rate"`
Lines map[int]int `json:"-"`
Ranges []RangeCoverage `json:"ranges,omitempty"`
}
FileCoverage represents coverage data for a single file.
type RangeCoverage ¶
type RangeCoverage struct {
StartLine int `json:"start_line"`
EndLine int `json:"end_line"`
Count int `json:"count"`
}
RangeCoverage records a covered line range.
type Report ¶
type Report struct {
Format string `json:"format"`
Files map[string]*FileCoverage `json:"files"`
TotalLines int `json:"total_lines"`
CoveredLines int `json:"covered_lines"`
CoverageRate float64 `json:"coverage_rate"`
}
Report holds the parsed test coverage report across all files.
func ParseCobertura ¶
ParseCobertura parses Cobertura XML format.
func ParseCoverageFile ¶
ParseCoverageFile reads and parses a coverage file, auto-detecting the format.
func ParseGoCover ¶
ParseGoCover parses Go's standard coverprofile format.
func ParseJaCoCo ¶
ParseJaCoCo parses the jacoco.xml written by the Maven and Gradle JaCoCo plugins. A file is keyed as "<package>/<sourcefile>", for example "com/acme/x/Foo.java": JaCoCo records no source root, so the key is relative to it. IsSymbolCovered already suffix-matches report paths against indexed paths, which resolves it to src/main/java/com/acme/x/Foo.java (or a Gradle module's src/main/kotlin) without a separate mapping.
A line counts as covered when any of its instructions ran (ci > 0), and as uncovered when none did but some exist (mi > 0). Lines with neither carry no executable code and are skipped, so they cannot dilute the rate. A partially covered line (mi > 0 and ci > 0) is covered: the line ran, which is the signal a line-level test-coverage map needs.