testplan.exporters.testing.xml package
Module contents
XML Export logic for test reports.
- class testplan.exporters.testing.xml.BaseRenderer[source]
Bases:
object
Base renderer, renders a test group report with the following structure:
TestGroupReport(name=..., category='<test-category>') TestGroupReport(name=..., category='testsuite') TestCaseReport(name=...) (failing) RawAssertion (dict form) TestCaseReport(name=...) (passing) TestCaseReport(name=...) (passing)
- get_testcase_reports(testsuite_report: Report) Generator[TestCaseReport, None, None] [source]
Generator function to yield testcases from a suite report recursively.
- Parameters:
testsuite_report – Testplan report
- Returns:
generator to produce all testcases
- render(source: TestGroupReport) Element [source]
Renders each suite separately and groups them within testsuites tag.
- Parameters:
source – Testplan report
- Returns:
testsuites element
- render_testcase(test_report: TestReport, testsuite_report: TestGroupReport, testcase_report: TestCaseReport) Element [source]
Renders a testcase with errors & failures within a testcase tag.
- Parameters:
test_report – Testplan report
testsuite_report – testsuite level report
testcase_report – testcase level report
- Returns:
testcase element
- render_testcase_errors(testcase_report: TestCaseReport) List[Element] [source]
Creates an error tag holding information via testcase report logs.
- Parameters:
testcase_report – testcase level report
- Returns:
error element
- render_testcase_failures(testcase_report: TestCaseReport) List[Element] [source]
Iterates over failing assertions to create failure tags.
- Parameters:
testcase_report – testcase level report
- Returns:
failure element
- render_testsuite(index, test_report, testsuite_report) Element [source]
Renders a single testsuite with its testcases within a testsuite tag.
- Parameters:
index – index of the testsuite as item in Testplan report
test_report – Testplan report
testsuite_report – testsuite level report
- Returns:
testsuite element
- class testplan.exporters.testing.xml.MultiTestRenderer[source]
Bases:
BaseRenderer
Source report represents a MultiTest with the following structure:
TestGroupReport(name=..., category='multitest') TestGroupReport(name=..., category='testsuite') TestCaseReport(name=...) Assertion entry (dict) Assertion entry (dict) TestGroupReport(name='...', category='parametrization') TestCaseReport(name=...) Assertion entry (dict) Assertion entry (dict) TestCaseReport(name=...) Assertion entry (dict) Assertion entry (dict)
Final XML will have flattened testcase data from parametrization groups.
- get_testcase_reports(testsuite_report: TestCaseReport | TestGroupReport) List[TestCaseReport] [source]
Collects all testcase level reports from a testsuite.
- Parameters:
testsuite_report
- Raises:
TypeError –
- Returns:
- class testplan.exporters.testing.xml.XMLExporter(name='XML exporter', **options)[source]
Bases:
BaseExporter
Exporter subclass for handling XML. Produces one XML file per each child of TestPlanReport (e.g. Multitest reports)
- Parameters:
xml_dir – Directory for saving xml reports.
- CONFIG
alias of
XMLExporterConfig
- export(source: TestReport, export_context: ExportContext | None = None) Dict | None [source]
Creates multiple XML files in the given directory for MultiTest.
- Parameters:
source – Testplan report to export
- Param:
export_context: information about other exporters
- Returns:
dictionary containing the possible output
- renderer_map: Dict[ReportCategories, BaseRenderer] = {'multitest': <class 'testplan.exporters.testing.xml.MultiTestRenderer'>}
- class testplan.exporters.testing.xml.XMLExporterConfig(**options)[source]
Bases:
ExporterConfig
Configuration object for
<~testplan.exporters.testing.xml.XMLExporter>
.