Orchestrates comprehensive testing of the modular workflow system.
| 41 | |
| 42 | |
| 43 | class TestSuiteRunner: |
| 44 | """Orchestrates comprehensive testing of the modular workflow system.""" |
| 45 | |
| 46 | def __init__(self, root_path: Path, github_token: Optional[str] = None): |
| 47 | """Initialize the test suite runner. |
| 48 | |
| 49 | Args: |
| 50 | root_path: Root path of the project |
| 51 | github_token: Optional GitHub token for API access |
| 52 | """ |
| 53 | self.root_path = root_path |
| 54 | self.github_token = github_token |
| 55 | self.results: List[TestSuiteResult] = [] |
| 56 | self.test_artifacts_dir = root_path / ".github" / "test-suite-artifacts" |
| 57 | |
| 58 | # Ensure test artifacts directory exists |
| 59 | self.test_artifacts_dir.mkdir(parents=True, exist_ok=True) |
| 60 | |
| 61 | # Detect repository info |
| 62 | self.repo_owner, self.repo_name = self._detect_repository_info() |
| 63 | |
| 64 | def run_test_suite(self, suite: TestSuite) -> bool: |
| 65 | """Run specified test suite.""" |
| 66 | print(f"Starting Test Suite: {suite.value.upper()}") |
| 67 | print("=" * 60) |
| 68 | |
| 69 | if suite == TestSuite.ALL: |
| 70 | return self._run_all_test_suites() |
| 71 | elif suite == TestSuite.VALIDATION: |
| 72 | return self._run_validation_tests() |
| 73 | elif suite == TestSuite.INTEGRATION: |
| 74 | return self._run_integration_tests() |
| 75 | elif suite == TestSuite.WORKFLOW: |
| 76 | return self._run_workflow_tests() |
| 77 | elif suite == TestSuite.LEGACY_MIGRATION: |
| 78 | return self._run_legacy_migration_tests() |
| 79 | else: |
| 80 | print(f"[ERROR] Unknown test suite: {suite}") |
| 81 | return False |
| 82 | |
| 83 | def _run_all_test_suites(self) -> bool: |
| 84 | """Run all test suites in order.""" |
| 85 | suites_to_run = [TestSuite.VALIDATION, TestSuite.INTEGRATION, TestSuite.WORKFLOW, TestSuite.LEGACY_MIGRATION] |
| 86 | |
| 87 | all_passed = True |
| 88 | |
| 89 | for suite in suites_to_run: |
| 90 | print(f"\n{'='*20} {suite.value.upper()} TESTS {'='*20}") |
| 91 | |
| 92 | start_time = time.time() |
| 93 | passed = self._run_single_suite(suite) |
| 94 | duration = time.time() - start_time |
| 95 | |
| 96 | result = TestSuiteResult(suite=suite, passed=passed, duration=duration, details={}) |
| 97 | |
| 98 | self.results.append(result) |
| 99 | |
| 100 | status = "[PASS]" if passed else "[FAIL]" |