Documentation
¶
Overview ¶
Package report provides handling functions for different report types
Index ¶
Constants ¶
const ( // detail: https://ltp.sourceforge.net/coverage/lcov/geninfo.1.php // number of instrumented lines LineFound = "LF" // number of lines with a non-zero execution count LineHit = "LH" // number of branches found BranchFound = "BRF" // number of branches hit BranchHit = "BRH" )
Variables ¶
var DefaultReportParsers = map[ReportType]ReportParser{ TypeJunitXml: &JunitParser{}, TypeMochaJson: &MochaJsonParser{}, TypeJestJson: &JestJsonParser{}, TypeLcov: &LcovParser{}, }
DefaultReportParsers consists of default supported report types
var SupportedTypes = []ReportType{ TypeJunitXml, }
SupportedTypes consists of default supported report types
Functions ¶
This section is empty.
Types ¶
type ConvertToAutomatedTestResult ¶
type ConvertToAutomatedTestResult interface {
ConvertToAutomatedTestResult() v1alpha1.AutomatedTestResult
}
ConvertToAutomatedTestResult provides an interface converted to AutomatedTestResult.
type ConvertToTestCoverage ¶
type ConvertToTestCoverage interface {
ConvertToTestCoverage() v1alpha1.TestCoverage
}
ConvertToTestCoverage provides an interface converted to TestCoverage.
type ConvertToTestResult ¶
type ConvertToTestResult interface {
ConvertToTestResult() v1alpha1.TestResult
}
ConvertToTestResult provides an interface converted to TestResult.
type JestJsonParser ¶
type JestJsonParser struct { // failed testsuite number. NumFailedTestSuites int `json:"numFailedTestSuites"` // failed test number. NumFailedTests int `json:"numFailedTests"` // passed testsuite number. NumPassedTestSuites int `json:"numPassedTestSuites"` // passed test number. NumPassedTests int `json:"numPassedTests"` // pinding testsuite number NumPendingTestSuites int `json:"numPendingTestSuites"` // pinding test number NumPendingTests int `json:"numPendingTests"` // error testsuite number NumRuntimeErrorTestSuites int `json:"numRuntimeErrorTestSuites"` // todo test number NumTodoTests int `json:"numTodoTests"` // total testsuite number NumTotalTestSuites int `json:"numTotalTestSuites"` // total test number NumTotalTests int `json:"numTotalTests"` // testsuites run status Success bool `json:"success"` }
JestJsonParser jest json parser
func (*JestJsonParser) ConvertToTestResult ¶
func (m *JestJsonParser) ConvertToTestResult() v1alpha1.TestResult
ConvertToTestResult convert to TestResult
func (*JestJsonParser) Parse ¶
func (m *JestJsonParser) Parse(path string) (result interface{}, err error)
Parse pase jest json report.
type JunitParser ¶
type JunitParser struct {
// save junit testsuites
Suites []junit.Suite
}
JunitParser junit parser
func (*JunitParser) ConvertToAutomatedTestResult ¶
func (m *JunitParser) ConvertToAutomatedTestResult() v1alpha1.AutomatedTestResult
ConvertToAutomatedTestResult convert to AutomatedTestResult
func (*JunitParser) ConvertToTestResult ¶
func (m *JunitParser) ConvertToTestResult() v1alpha1.TestResult
ConvertToTestResult convert to TestResult
func (*JunitParser) Parse ¶
func (p *JunitParser) Parse(path string) (testResult interface{}, err error)
Parse pase junit report.
type LcovParser ¶
type LcovParser struct { // LineFound found lines LineFound int // LineHit converage hit lines LineHit int // BranchFound found branch BranchFound int // BranchHit converage hit branch BranchHit int }
LcovParser lcov report parser
func (*LcovParser) ConvertToTestCoverage ¶
func (p *LcovParser) ConvertToTestCoverage() v1alpha1.TestCoverage
ConvertToTestCoverage convert to TestCoverage
func (*LcovParser) Parse ¶
func (p *LcovParser) Parse(path string) (result interface{}, err error)
Parse parse lcov report.
type MochaJsonParser ¶
type MochaJsonParser struct {
Stats MochaJsonStats `json:"stats"`
}
MochaJsonParser mocha json report parser
func (*MochaJsonParser) ConvertToTestResult ¶
func (m *MochaJsonParser) ConvertToTestResult() v1alpha1.TestResult
ConvertToTestResult convert to TestResult
func (*MochaJsonParser) Parse ¶
func (m *MochaJsonParser) Parse(path string) (interface{}, error)
Parse parse mocha json report.
type MochaJsonStats ¶
type MochaJsonStats struct { // total testsuite Suites int `json:"suites"` // total test Tests int `json:"tests"` // passed test number Passes int `json:"passes"` // pending test number Pending int `json:"pending"` // failed test number Failures int `json:"failures"` // other test number Other int `json:"other"` // skipped test number Skipped int `json:"skipped"` }
MochaJsonStats unit test data structures for Mocha json.
type ReportParser ¶
ReportParser provides an interface for parsing reports.
type ReportType ¶
type ReportType string
ReportType defines report type
const ( // TypeJestJson is the type of jest-json TypeJestJson ReportType = "jest-json" )
const ( // TypeJunitXml is the type of junit-xml TypeJunitXml ReportType = "junit-xml" )
const ( // TypeLcov is the type of lcov TypeLcov ReportType = "lcov" )
const ( // TypeMochaJson is the type of mocha json TypeMochaJson ReportType = "mocha-json" )
type SummariesByType ¶
type SummariesByType map[ReportType]v1alpha1.AutomatedTestResult
SummariesByType stores TestSummary by ReportType