Skip to content

Junit report format

junit_report_format

Module for outputting Junit test results to xml.

Used to support CI/CD and exporting test results for other tools. This does test report generation without being a test runner.

JunitReportError

Object representing a Test Error.

__init__

__init__(type: str, msg: str) -> JunitReportError

Init the type of error.

JunitReportFailure

Object representing a Test Failure.

__init__

__init__(type: str, msg: str) -> JunitReportFailure

Init the type of Failure.

JunitReportTestCase

Object representing a single test case.

__init__

__init__(Name: str, ClassName: str) -> JunitReportTestCase

Init a Test case with it's name and class name.

SetFailed

SetFailed(Msg: str, Type: str) -> None

Sets internal state if the test failed.

SetError

SetError(Msg: str, Type: str) -> None

Set internal state if the test had an error.

SetSuccess

SetSuccess() -> None

Set internal state if the test passed.

SetSkipped

SetSkipped() -> None

Set internal state if the test was skipped.

LogStdOut

LogStdOut(msg: str) -> None

Log to the standard out.

LogStdError

LogStdError(msg: str) -> None

Log to the standard err.

Output

Output(outstream: IO) -> None

Write the test result to the outstream.

JunitReportTestSuite

Object representing the overall test suite.

Create new suites by using the JunitTestReport Object

__init__

__init__(
    Name: str, Package: str, Id: id
) -> JunitReportTestSuite

Initialize a new test suite.

create_new_testcase

create_new_testcase(
    name: str, classname: str
) -> JunitReportTestCase

Create a new test case.

Returns:

Type Description
JunitReportTestCase

newly created test case

Output

Output(outstream: IO) -> None

Output the test results to the stream.

JunitTestReport

Object representing a Test Report.

Top level object test reporting.

__init__

__init__() -> JunitTestReport

Init an empty test report.

create_new_testsuite

create_new_testsuite(
    name: str, package: str
) -> JunitReportTestSuite

Create a new test suite.

Returns:

Type Description
JunitReportTestSuite

newly created testsuite

Output

Output(filepath: str) -> None

Write report to file.