junitparser.xunit2 module

The flavor based on Jenkins xunit plugin: https://github.com/jenkinsci/xunit-plugin/blob/xunit-2.3.2/src/main/resources/org/jenkinsci/plugins/xunit/types/model/xsd/junit-10.xsd

According to the internet, the schema is compatible with:

  • Pytest (as default, though it also supports a “legacy” xunit1 flavor)

  • Erlang/OTP

  • Maven Surefire

  • CppTest

There may be many others that I’m not aware of.

class junitparser.xunit2.FlakyError(message: str = None, type_: str = None)[source]

Bases: InterimResult

class junitparser.xunit2.FlakyFailure(message: str = None, type_: str = None)[source]

Bases: InterimResult

class junitparser.xunit2.InterimResult(message: str = None, type_: str = None)[source]

Bases: Result

Base class for intermediate (rerun and flaky) test result (in contrast to JUnit FinalResult).

property stack_trace

<stackTrace>

property system_err

<system-err>

property system_out

<system-out>

class junitparser.xunit2.JUnitXml(name=None)[source]

Bases: JUnitXml

skipped = None
testsuite

alias of TestSuite

update_statistics()[source]

Update test count, time, etc.

class junitparser.xunit2.RerunError(message: str = None, type_: str = None)[source]

Bases: InterimResult

class junitparser.xunit2.RerunFailure(message: str = None, type_: str = None)[source]

Bases: InterimResult

class junitparser.xunit2.StackTrace(content: str = None)[source]

Bases: System

class junitparser.xunit2.TestCase(name: str = None, classname: str = None, time: float = None)[source]

Bases: TestCase

ITER_TYPES = {'error': <class 'junitparser.junitparser.Error'>, 'failure': <class 'junitparser.junitparser.Failure'>, 'flakyError': <class 'junitparser.xunit2.FlakyError'>, 'flakyFailure': <class 'junitparser.xunit2.FlakyFailure'>, 'rerunError': <class 'junitparser.xunit2.RerunError'>, 'rerunFailure': <class 'junitparser.xunit2.RerunFailure'>, 'skipped': <class 'junitparser.junitparser.Skipped'>, 'system-err': <class 'junitparser.junitparser.SystemErr'>, 'system-out': <class 'junitparser.junitparser.SystemOut'>}
add_interim_result(result: InterimResult)[source]

Append an interim (rerun or flaky) result to the testcase. A testcase can have multiple interim results.

flaky_errors() List[FlakyError][source]

<flakyError>

flaky_failures() List[FlakyFailure][source]

<flakyFailure>

group

An attribute for an XML element.

By default they are all string values. To support different value types, inherit this class and define your own methods.

Also see: IntAttr, FloatAttr.

property interim_result: List[InterimResult]

RerunFailure, RerunError, FlakyFailure, or FlakyError objects. This is complementary to the result property returning final results.

Type:

A list of interim results

property is_flaky: bool

Whether this testcase is flaky, i.e., there are flaky failures or errors.

property is_rerun: bool

Whether this testcase is rerun, i.e., there are rerun failures or errors.

rerun_errors() List[RerunError][source]

<rerunError>

rerun_failures() List[RerunFailure][source]

<rerunFailure>

class junitparser.xunit2.TestSuite(name=None)[source]

Bases: TestSuite

TestSuite for Pytest, with some different attributes.

file

An attribute for an XML element.

By default they are all string values. To support different value types, inherit this class and define your own methods.

Also see: IntAttr, FloatAttr.

group

An attribute for an XML element.

By default they are all string values. To support different value types, inherit this class and define your own methods.

Also see: IntAttr, FloatAttr.

id

An attribute for an XML element.

By default they are all string values. To support different value types, inherit this class and define your own methods.

Also see: IntAttr, FloatAttr.

log

An attribute for an XML element.

By default they are all string values. To support different value types, inherit this class and define your own methods.

Also see: IntAttr, FloatAttr.

package

An attribute for an XML element.

By default they are all string values. To support different value types, inherit this class and define your own methods.

Also see: IntAttr, FloatAttr.

property system_err

<system-err>

property system_out

<system-out>

testcase

alias of TestCase

url

An attribute for an XML element.

By default they are all string values. To support different value types, inherit this class and define your own methods.

Also see: IntAttr, FloatAttr.

version

An attribute for an XML element.

By default they are all string values. To support different value types, inherit this class and define your own methods.

Also see: IntAttr, FloatAttr.