Exemple #1
0
    def _run_serial_testcases(self, testsuite, testcases):
        """Run testcases serially and return a list of test reports."""
        parametrization_reports = self._parametrization_reports(
            testsuite, testcases
        )
        testcase_reports = []
        pre_testcase = getattr(testsuite, "pre_testcase", None)
        post_testcase = getattr(testsuite, "post_testcase", None)

        for testcase in testcases:
            if not self.active:
                break

            testcase_report = self._run_testcase(
                testcase, pre_testcase, post_testcase
            )

            param_template = getattr(
                testcase, "_parametrization_template", None
            )
            if param_template:
                parametrization_reports[param_template].append(testcase_report)
            else:
                testcase_reports.append(testcase_report)

            if testcase_report.status == testplan.report.Status.ERROR:
                if self.cfg.stop_on_error:
                    self.logger.debug(
                        "Stopping exeucution of testsuite %s due to error.",
                        mtest_suite.get_testsuite_name(testsuite),
                    )
                    break

        # Add all non-empty parametrization reports into the list of returned
        # testcase reports, to be added to the suite report.
        for param_report in parametrization_reports.values():
            if param_report.entries:
                testcase_reports.append(param_report)

        return testcase_reports
Exemple #2
0
 def filter_suite(self, suite):
     return fnmatch.fnmatch(
         suite.__class__.__name__
         if self.match_definition else get_testsuite_name(suite),
         self.suite_pattern,
     )