Documentation
¶
Overview ¶
Package report provides an API to add properties to, and extract properties from, the JUnit XML test report.
To attach a key-value property to the currently running test suite in the XML report, use the `AddSuiteProperty` method. For example:
ondatra.Report().AddSuiteProperty("mySuiteKey", "mySuiteValue")
To attach a key-value property to the currently running test case, use the `AddTestProperty` method. For example:
ondatra.Report().AddTestProperty(t, "myTestKey", "myTestValue")
In reality, JUnit XML only supports top-level/suite properties, so `AddTestProperty` must specially-encode test properties in suite properties. Use `ReadXML` to programmatically parse the XML file into a structured JUnit report, and use `ExtractProperties` to decode the suite properties back into separate test-level and suite-level properties.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractProperties ¶
func ExtractProperties(suites junit.Testsuites) map[string]map[string]string
ExtractProperties extracts a testName->propertyName->propertyValue map from the specified JUnit Testsuites. It assumes the specified Testsuites contains exactly one Testsuite, since the XML report always contains exactly one, and if the Testsuite contains multiple properties with the same name, later property values overwrite earlier property values.
Types ¶
type Report ¶
type Report struct{}
Report is the API to customizing a JUnit XML report.
func (*Report) AddRawProperty ¶
AddRawProperty attaches a name-value property to the specified test name in the generated the XML report. If the test name is the empty string, the property is attached to the test suite. For improved test readability, callers should prefer using AddSuiteProperty or AddTestProperty.
func (*Report) AddSuiteProperty ¶
AddSuiteProperty attaches a name-value property to the test suite in the generated XML report. This is preferred, but equivalent, to calling AddRawProperty("", name, value).