Run multiple test cases and return summary. Args: test_cases: List of test case dictionaries Returns: Dictionary with test summary and results
(self, test_cases: list[dict[str, Any]])
| 156 | raise ValueError(f"Error loading test file: {e}") from e |
| 157 | |
| 158 | async def run_tests(self, test_cases: list[dict[str, Any]]) -> dict[str, Any]: |
| 159 | """ |
| 160 | Run multiple test cases and return summary. |
| 161 | |
| 162 | Args: |
| 163 | test_cases: List of test case dictionaries |
| 164 | |
| 165 | Returns: |
| 166 | Dictionary with test summary and results |
| 167 | """ |
| 168 | results = [] |
| 169 | passed = 0 |
| 170 | failed = 0 |
| 171 | |
| 172 | self.logger.info(f"Running {len(test_cases)} tests of type {self.test_type.value}") |
| 173 | |
| 174 | for idx, test_case in enumerate(test_cases, 1): |
| 175 | # Validate test case |
| 176 | is_valid, error_msg = self.validate_test_case(test_case) |
| 177 | |
| 178 | if not is_valid: |
| 179 | self.logger.error(f"Invalid test case {idx}: {error_msg}") |
| 180 | result = TestResult( |
| 181 | test_case=TestCase( |
| 182 | test_type=self.test_type, |
| 183 | test_id=idx, |
| 184 | original_case_num=test_case.get('original_case_num', idx) |
| 185 | ), |
| 186 | success=False, |
| 187 | error=f"Validation error: {error_msg}" |
| 188 | ) |
| 189 | failed += 1 |
| 190 | else: |
| 191 | # Run the test |
| 192 | try: |
| 193 | result = await self.run_single_test(test_case) |
| 194 | if result.success: |
| 195 | passed += 1 |
| 196 | else: |
| 197 | failed += 1 |
| 198 | except Exception as e: |
| 199 | self.logger.exception(f"Error running test {idx}: {e}") |
| 200 | result = TestResult( |
| 201 | test_case=TestCase( |
| 202 | test_type=self.test_type, |
| 203 | test_id=idx, |
| 204 | original_case_num=test_case.get('original_case_num', idx) |
| 205 | ), |
| 206 | success=False, |
| 207 | error=str(e) |
| 208 | ) |
| 209 | failed += 1 |
| 210 | |
| 211 | results.append(result) |
| 212 | |
| 213 | # Generate summary |
| 214 | summary = { |
| 215 | 'test_type': self.test_type.value, |
no test coverage detected