Пример #1
0
        def __init__(self, thread_id: int, module: str, test: str,
                     input_data: dict, config: dict, log: Log):
            threading.Thread.__init__(self)
            self._statistic = Statistic(test, thread_id, config, log)

            self._test_class = test_classes[module](input_data, config,
                                                    self._statistic)
            self._test = test
            self._id = str(thread_id)
Пример #2
0
    def run(self):
        """Запуск тест кейса.

        :return:
        """

        test_case_statistic = Statistic("Тест-кейс", 1, self._runner_config,
                                        self._log)
        test_threads: list = []

        for test in self._tests_config:
            test_case_statistic.append_success(
                "----------------------------------ТЕСТ " + test['module'] +
                "." + test['test'] + "------------------------------------",
                "ЗАПУСК")
            for thread in range(test['threads']):
                test_threads.append(
                    self.TestRunner(thread + 1, test['module'], test['test'],
                                    test['input_data'], self._runner_config,
                                    self._log))
            for thread in test_threads:
                thread.start()
            for thread in test_threads:
                thread.join()
            test_case_statistic.append_success(
                "----------------------------------ТЕСТ " + test['module'] +
                "." + test['test'] + "------------------------------------",
                "ЗАВЕРШЕНИЕ")
            for thread in test_threads:
                statistic = thread.get_statistic()
                statistic.show_errors_statistic()
                statistic.show_warns_statistic()
                if self._runner_config['settings']['create_report']:
                    statistic.create_report()
            test_threads.clear()
            time.sleep(test['wait_time'])
        return True