Skip to main content

Step Status

Overview

The StepStatus enumeration is designed to represent the possible states of a StepResult, indicating the current status of an individual test step within a scenario.

from enum import Enum

class StepStatus(Enum):
PENDING = "PENDING"
PASSED = "PASSED"
FAILED = "FAILED"
  • PENDING: Indicates the step is awaiting execution.
  • PASSED: Signifies the step has completed successfully.
  • FAILED: Marks the step as unsuccessful due to an assertion failure or an unexpected error.

Unlike scenarios, steps do not have a SKIPPED status because skipping is managed at the scenario level, affecting all steps within that scenario.

Note

The PASSED and FAILED statuses are final for a StepResult. Once assigned, these statuses cannot change.

Usage Examples

The following examples demonstrate how to use the StepStatus enumeration in Vedro plugins during different step execution phases within a testing scenario.

from vedro.core import Dispatcher, Plugin, StepStatus
from vedro.events import StepRunEvent

class CustomPlugin(Plugin):
def subscribe(self, dispatcher: Dispatcher) -> None:
dispatcher.listen(StepRunEvent, self.on_step_run)

def on_step_run(self, event: StepRunEvent) -> None:
assert event.step_result.status == StepStatus.PENDING