Documentation ¶
Index ¶
- Variables
- func GetCoveragePercentageXMLDisplay(percentageCoverages *coveragecalculator.CoveragePercentages) (string, error)
- func GetHTMLCoverageValuesDisplay(coverageValues *coveragecalculator.CoverageValues) (string, error)
- func GetHTMLDisplay(coverageData []coveragecalculator.TypeCoverage, ...) (string, error)
- type DisplayRules
- type HtmlDisplayData
Constants ¶
This section is empty.
Variables ¶
View Source
var AggregateCoverageTmpl = fmt.Sprint(`<!DOCTYPE html>
<html>
<style type="text/css">
<!--
.tab { margin-left: 50px; }
.styleheader {color: white; size: A4}
.values {color: yellow; size: A3}
table, th, td { border: 1px solid white; text-align: center}
.braces {color: white; size: A3}
-->
</style>
<body style="background-color:rgb(0,0,0); font-family: Arial">
<table style="width: 30%">
<tr class="styleheader"><td>Total Fields</td><td>{{ .TotalFields }}</td></tr>
<tr class="styleheader"><td>Covered Fields</td><td>{{ .CoveredFields }}</td></tr>
<tr class="styleheader"><td>Ignored Fields</td><td>{{ .IgnoredFields }}</td></tr>
<tr class="styleheader"><td>Coverage Percentage</td><td>{{ .PercentCoverage }}</td></tr>
</table>
</body>
</html>
`)
View Source
var JunitResultTmpl = fmt.Sprint(`<testsuites>
<testsuite name="" time="0" {{ if .IsFailedBuild }} failures="1" {{ else }} failures = "0" {{ end }} tests="0">
<testcase name="Overall" time="0" classname="go_coverage">
{{ if .IsFailedBuild }}
<failure>true</failure>
{{ end }}
<properties>
<property name="coverage" value="{{ .GetAndRemoveResourceValue "Overall" }}"/>
</properties>
</testcase>
{{ range $key, $value := .ResourceCoverages }}
<testcase name="{{ $key }}" time="0" classname="go_coverage">
<properties>
<property name="coverage" value="{{ $value }}"/>
</properties>
</testcase>
{{end}}
</testsuite>
</testsuites>`)
View Source
var TypeCoverageTempl = fmt.Sprint(`<!DOCTYPE html>
<html>
<style type="text/css">
<!--
.tab { margin-left: 50px; }
.styleheader {color: white; size: A4}
.covered {color: green; size: A3}
.notcovered {color: red; size: A3}
.ignored {color: white; size: A4}
.values {color: yellow; size: A3}
table, th, td { border: 1px solid white; text-align: center}
.braces {color: white; size: A3}
-->
</style>
<body style="background-color:rgb(0,0,0); font-family: Arial">
{{ range $coverageType := .TypeCoverages }}
<div class="styleheader">
<br>Package: {{ $coverageType.Package }}
<br>Type: {{ $coverageType.Type }}
<br>
<div class="braces">
<br>{
</div>
{{ range $key, $value := $coverageType.Fields }}
{{if $value.Ignored }}
<div class="ignored tab">{{ $value.Field }}</div>
{{else if $value.Coverage}}
<div class="covered tab">{{ $value.Field }}
{{ $valueLen := len $value.Values }}
{{if gt $valueLen 0 }}
    <span class="values">Values: [{{$value.GetValuesForDisplay}}]</span>
{{end}}
</div>
{{else}}
<div class="notcovered tab">{{ $value.Field }}</div>
{{end}}
{{end}}
<div class="braces">}</div>
</div>
{{end}}
<br>
<br>
<div class="styleheader">Coverage Values</div>
<br>
<table style="width: 30%">
<tr class="styleheader"><td>Total Fields</td><td>{{ .CoverageNumbers.TotalFields }}</td></tr>
<tr class="styleheader"><td>Covered Fields</td><td>{{ .CoverageNumbers.CoveredFields }}</td></tr>
<tr class="styleheader"><td>Ignored Fields</td><td>{{ .CoverageNumbers.IgnoredFields }}</td></tr>
<tr class="styleheader"><td>Coverage Percentage</td><td>{{ .CoverageNumbers.PercentCoverage }}</td></tr>
</table>
</body>
</html>
`)
Functions ¶
func GetCoveragePercentageXMLDisplay ¶
func GetCoveragePercentageXMLDisplay( percentageCoverages *coveragecalculator.CoveragePercentages) (string, error)
GetCoveragePercentageXMLDisplay is a helper method to write resource coverage percentage values to junit xml file format.
func GetHTMLCoverageValuesDisplay ¶
func GetHTMLCoverageValuesDisplay(coverageValues *coveragecalculator.CoverageValues) (string, error)
GetHTMLCoverageValuesDisplay is a helper method to display coverage values inside a HTML table.
func GetHTMLDisplay ¶
func GetHTMLDisplay(coverageData []coveragecalculator.TypeCoverage, coverageValues *coveragecalculator.CoverageValues) (string, error)
GetHTMLDisplay is a helper method to display API Coverage details in json-like format inside a HTML page.
Types ¶
type DisplayRules ¶
type DisplayRules struct { PackageNameRule func(packageName string) string TypeNameRule func(typeName string) string FieldRule func(coverage *coveragecalculator.FieldCoverage) string }
DisplayRules provides a mechanism for repos to define their own display rules. DisplayHelper methods can use these rules to define how to display results.
type HtmlDisplayData ¶
type HtmlDisplayData struct { TypeCoverages []coveragecalculator.TypeCoverage CoverageNumbers *coveragecalculator.CoverageValues }
Click to show internal directories.
Click to hide internal directories.