run teststep, step maybe any kind that implements IStep interface Args: step (Step): teststep
(self, step)
| 172 | return self.parser.parse_variables(variables) |
| 173 | |
| 174 | def __run_step(self, step): |
| 175 | """run teststep, step maybe any kind that implements IStep interface |
| 176 | |
| 177 | Args: |
| 178 | step (Step): teststep |
| 179 | |
| 180 | """ |
| 181 | logger.info(f"run step begin: {step.name()} >>>>>>") |
| 182 | |
| 183 | # run step |
| 184 | for i in range(step.retry_times + 1): |
| 185 | try: |
| 186 | if ALLURE is not None: |
| 187 | with ALLURE.step(f"step: {step.name()}"): |
| 188 | step_result: StepResult = step.run(self) |
| 189 | else: |
| 190 | step_result: StepResult = step.run(self) |
| 191 | break |
| 192 | except ValidationFailure: |
| 193 | if i == step.retry_times: |
| 194 | raise |
| 195 | else: |
| 196 | logger.warning( |
| 197 | f"run step {step.name()} validation failed,wait {step.retry_interval} sec and try again" |
| 198 | ) |
| 199 | time.sleep(step.retry_interval) |
| 200 | logger.info( |
| 201 | f"run step retry ({i + 1}/{step.retry_times} time): {step.name()} >>>>>>" |
| 202 | ) |
| 203 | |
| 204 | # save extracted variables to session variables |
| 205 | self.__session_variables.update(step_result.export_vars) |
| 206 | # update testcase summary |
| 207 | self.__step_results.append(step_result) |
| 208 | |
| 209 | logger.info(f"run step end: {step.name()} <<<<<<\n") |
| 210 | |
| 211 | def test_start(self, param: Dict = None) -> "SessionRunner": |
| 212 | """main entrance, discovered by pytest""" |