Documentation
¶
Overview ¶
Package json2junit converts JSON Go test output to JUnit XML format.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertFile ¶
ConvertFile reads a Go test JSON file and creates a JUnit XML file with converted content. Creates the directory containing the target file if necessary.
func ConvertFileWithOptions ¶ added in v0.0.10
ConvertFileWithOptions reads a Go test JSON file and creates a JUnit XML file with converted content. Creates the directory containing the target file if necessary. If opts is nil, default options are used.
Types ¶
type Converter ¶
type Converter struct {
// contains filtered or unexported fields
}
A Converter holds the state of a JSON-to-JUnit conversion. It implements io.WriteCloser; call Write with JSON test output, then Close. The JUnit output is written to the writer w that was passed to NewConverter.
The JSON input is buffered, so the caller can write it in arbitrary size chunks that don't have to align with the JSON lines. The JUnit output is not written immediately, but chunked into test suites which are written to w as soon as they are complete.
func NewConverter ¶
NewConverter returns a "JSON to JUnit" converter. Writes on the returned writer are written as JUnit to w, with minimal delay.
func NewConverterWithOptions ¶ added in v0.0.10
NewConverterWithOptions returns a "JSON to JUnit" converter with the given options. If opts is nil, default options are used.
type Options ¶ added in v0.0.10
type Options struct {
// IncludePackageInTestName prefixes each test case name with its package path,
// e.g. "crypto/sha256.TestGolden" instead of "TestGolden".
IncludePackageInTestName bool
// JobAttempt is a label for the CI job-level rerun attempt (e.g. System.StageAttempt
// in Azure DevOps), included in JUnit test suite names. If empty, no label is added.
JobAttempt string
}
Options configures the conversion behavior.