Execute one test case and handle failures.
(
self, test_case_method: MethodType, test_case_result: TestCaseResult
)
| 401 | test_case_result.update(Result.ERROR) |
| 402 | |
| 403 | def _execute_test_case( |
| 404 | self, test_case_method: MethodType, test_case_result: TestCaseResult |
| 405 | ) -> None: |
| 406 | """ |
| 407 | Execute one test case and handle failures. |
| 408 | """ |
| 409 | test_case_name = test_case_method.__name__ |
| 410 | try: |
| 411 | self._logger.info(f"Starting test case execution: {test_case_name}") |
| 412 | test_case_method() |
| 413 | test_case_result.update(Result.PASS) |
| 414 | self._logger.info(f"Test case execution PASSED: {test_case_name}") |
| 415 | |
| 416 | except TestCaseVerifyError as e: |
| 417 | self._logger.exception(f"Test case execution FAILED: {test_case_name}") |
| 418 | test_case_result.update(Result.FAIL, e) |
| 419 | except Exception as e: |
| 420 | self._logger.exception(f"Test case execution ERROR: {test_case_name}") |
| 421 | test_case_result.update(Result.ERROR, e) |
| 422 | except KeyboardInterrupt: |
| 423 | self._logger.error(f"Test case execution INTERRUPTED by user: {test_case_name}") |
| 424 | test_case_result.update(Result.SKIP) |
| 425 | raise KeyboardInterrupt("Stop DTS") |
| 426 | |
| 427 | |
| 428 | def get_test_suites(testsuite_module_path: str) -> list[type[TestSuite]]: |