Exemplo n.º 1
0
    def _initial_report(self):
        """Generate the initial report skeleton."""
        report = testplan.report.TestReport(name=self.cfg.name,
                                            uid=self.cfg.name)

        for test_uid in self.all_tests():
            test = self.test(test_uid)
            test_report = test.dry_run().report
            report.append(test_report)

        return report
Exemplo n.º 2
0
    def run_tests(self):
        """Run all tests as a batch and return the results."""
        testsuites = self.test_context
        self._init_test_report()
        report = self.report
        report.runtime_status = testplan.report.RuntimeStatus.RUNNING

        with report.timer.record("run"):
            if _need_threadpool(testsuites):
                self._thread_pool = futures.ThreadPoolExecutor(
                    self._thread_pool_size
                )

            for testsuite, testcases in testsuites:
                if not self.active:
                    report.logger.error("Not all of the suites are done.")
                    st = testplan.report.Status.precedent(
                        [report.status, testplan.report.Status.INCOMPLETE]
                    )
                    if st != report.status:
                        report.status_override = (
                            testplan.report.Status.INCOMPLETE
                        )
                    break

                testsuite_report = self._run_suite(testsuite, testcases)
                report.append(testsuite_report)

                style = self.get_stdout_style(testsuite_report.passed)
                if style.display_testsuite:
                    self.log_suite_status(testsuite_report)

            style = self.get_stdout_style(report.passed)
            if style.display_test:
                self.log_multitest_status(report)

            if self._thread_pool is not None:
                self._thread_pool.shutdown()
                self._thread_pool = None

        report.runtime_status = testplan.report.RuntimeStatus.FINISHED

        return report
Exemplo n.º 3
0
    def _initial_report(self):
        """Generate the initial report skeleton."""
        report = testplan.report.TestReport(name=self.cfg.name,
                                            uid=self.cfg.name)

        for test_uid, runner_uid in self.all_tests():
            test = self.test(test_uid, runner_uid=runner_uid)

            for suite in test.suites:
                suite_name = suite.__class__.__name__
                suite_report = testplan.report.TestGroupReport(
                    name=suite_name, uid=suite_name, category="suite")

                for testcase in suite.get_testcases():
                    testcase_name = testcase.__name__
                    testcase_report = testplan.report.TestCaseReport(
                        name=testcase_name, uid=testcase_name)
                    suite_report.append(testcase_report)

                test.result.report.append(suite_report)

            report.append(test.result.report)

        return report