Skip to content

Skip dependent steps when a prior step fails #64

@dotnetprofessional

Description

@dotnetprofessional

Problem

When a step fails in a scenario, subsequent steps still execute even though they have no chance of passing. This wastes time — especially in UI automation where steps can be slow — and clutters output with cascading failures.

Current Behavior (Vitest)

Each step is registered as an independent Vitest task. When a step throws, the error is re-thrown but remaining steps in the scenario still execute. There is no scenario-level execution context that can conditionally skip remaining steps.

Proposed Behavior

Skip dependent steps based on Gherkin semantics:

  • \given\ fails → execute remaining \given\ steps (to see what's broken), skip all \when\ and \ hen\
  • \when\ fails → skip remaining \when\ steps, skip all \ hen\
  • \ hen\ fails → continue executing remaining \ hen\ steps (they're typically fast assertions)

Skipped steps should be reported with a \skipped\ status (not \pending\ or \ ail) and the reason for skipping.

Technical Notes

  • Vitest's task model doesn't natively support conditional skipping of registered tasks at execution time
  • Would need a scenario-level execution tracker that steps check before running
  • The xUnit version doesn't need this — C# sequential method execution naturally aborts on exception

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions