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: testplan.common.report.base.Report) → Generator[testplan.report.testing.base.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: testplan.report.testing.base.TestGroupReport) → lxml.etree.Element[source]¶ Renders each suite separately and groups them within testsuites tag.
Parameters: source – Testplan report Returns: testsuites element
-
render_testcase
(test_report: testplan.report.testing.base.TestReport, testsuite_report: testplan.report.testing.base.TestGroupReport, testcase_report: testplan.report.testing.base.TestCaseReport) → lxml.etree.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: testplan.report.testing.base.TestCaseReport) → List[lxml.etree.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: testplan.report.testing.base.TestCaseReport) → List[lxml.etree.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) → lxml.etree.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:
testplan.exporters.testing.xml.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: Union[testplan.report.testing.base.TestCaseReport, testplan.report.testing.base.TestGroupReport]) → List[testplan.report.testing.base.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:
testplan.common.exporters.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: testplan.report.testing.base.TestReport, export_context: Optional[testplan.common.exporters.ExportContext] = None) → Optional[Dict[KT, VT]][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
= {<ReportCategories.MULTITEST: 'multitest'>: <class 'testplan.exporters.testing.xml.MultiTestRenderer'>}¶
-
-
class
testplan.exporters.testing.xml.
XMLExporterConfig
(**options)[source]¶ Bases:
testplan.common.exporters.ExporterConfig
Configuration object for
<~testplan.exporters.testing.xml.XMLExporter>
.