trlcdoc.testrun =============== .. py:module:: trlcdoc.testrun .. autoapi-nested-parse:: Run the tests and convert the JUnit XML results into TRLC test result records. Attributes ---------- .. autoapisummary:: trlcdoc.testrun.RESULTS_FILE trlcdoc.testrun.LOG trlcdoc.testrun.PYTEST_OK_CODES trlcdoc.testrun.QUALIFIED_ID trlcdoc.testrun.UNITY_OUTPUT trlcdoc.testrun.MTIME_TOLERANCE Functions --------- .. autoapisummary:: trlcdoc.testrun.run_tests trlcdoc.testrun.read_junit trlcdoc.testrun.write_results Module Contents --------------- .. py:data:: RESULTS_FILE :value: 'sw_test_result_report.trlc' .. py:data:: LOG .. py:data:: PYTEST_OK_CODES :value: (0, 1) .. py:data:: QUALIFIED_ID :value: '(?P[A-Za-z_][A-Za-z0-9_]*\\.[A-Za-z_][A-Za-z0-9_]*)' .. py:data:: UNITY_OUTPUT .. py:data:: MTIME_TOLERANCE :value: 2.0 .. py:function:: run_tests(cfg: trlcdoc.config.Config) -> bool Run the tests and create the TRLC test result records. :param cfg: Project configuration with a tests section. :type cfg: Config :returns: True if all tests passed. :rtype: bool :raises TrlcdocError: If the tests could not be executed. .. py:function:: read_junit(junit_file: pathlib.Path, link: dict[str, Any]) -> list[tuple[str, bool, list[str]]] Read the test results and link them to their TRLC test cases. Skipped tests have no result and are not part of the list. :param junit_file: JUnit XML file. :type junit_file: Path :param link: The tests.link configuration. :type link: dict[str, Any] :returns: (test name, passed, qualified test case ids) per test. :rtype: list[tuple[str, bool, list[str]]] :raises TrlcdocError: If a test cannot be linked to a test case, or to several :raises test cases while tests.link.array is not set.: .. py:function:: write_results(results: list[tuple[str, bool, list[str]]], trlc_file: pathlib.Path, link: dict[str, Any]) -> pathlib.Path Write the test results as TRLC SwTestCaseResult records. The records are written into the package of the linked test cases. :param results: (test name, passed, qualified test case ids) per test. :type results: list[tuple[str, bool, list[str]]] :param trlc_file: TRLC file to write. :type trlc_file: Path :param link: The tests.link configuration. With 'array' the relates component is written as list, otherwise as single reference. :type link: dict[str, Any] :returns: The written file. :rtype: Path :raises TrlcdocError: If the package of the test cases cannot be determined.