Skip to content

fix(StopOnFailure): Wire up Options.StopOnFailure to stop the suite on first step and scenario failure - #770

Open
kcross-ctoken wants to merge 1 commit into
cucumber:mainfrom
kcross-ctoken:stop-on-failure
Open

fix(StopOnFailure): Wire up Options.StopOnFailure to stop the suite on first step and scenario failure#770
kcross-ctoken wants to merge 1 commit into
cucumber:mainfrom
kcross-ctoken:stop-on-failure

Conversation

@kcross-ctoken

@kcross-ctoken kcross-ctoken commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

🤔 What's changed?

  • Propagates stopOnFailure into the per-pickle suite copy in run.go so it reaches suite-level hook handling, and stops running remaining before-step hooks once one has failed.
  • Adds a BDD test in features/events.feature proving that once a scenario fails with StopOnFailure enabled, later scenarios in the run are skipped entirely (not just their steps).
  • Scenarios skipped this way are now recorded instead of silently omitted: suite.skipPickle() inserts a PickleResult and a Skipped PickleStepResult per step, and both run.go and the BDD test harness call it instead of just returning/continuing before the pickle is ever touched. The summary now reports them accurately, e.g. 3 scenarios (1 passed, 1 failed, 1 skipped) with their steps counted too, instead of the scenario vanishing from the totals entirely.
    • fmt_base.go's Summary() gains a scenario-level skipped bucket (a scenario whose steps are all skipped, i.e. it never ran).
    • fmt_junit.go's per-step skipped case now actually sets tc.Status, since it used to rely entirely on a fallback for pickles with no result at all, which no longer occurs now that skipped pickles get a real result.

⚡️ What's your motivation?
fix StopOnFailure to correctly work

🏷️ What kind of change is this?
Bug fix

♻️ Anything particular you want feedback on?
Building and testing is hard to get right at the beginning due to specific versions required.
I would suggest we use mise to set our tooling versions and use this in our ci.

📋 Checklist:
I agree to respect and uphold the Cucumber Community Code of Conduct
pull request.

…lure

Propagate stopOnFailure into the per-pickle suite copy in run.go so it
reaches suite-level hook handling, and stop running remaining
before-step hooks once one has failed. Add a BDD test in
features/events.feature proving that once a scenario fails, later
scenarios in the run are skipped entirely (not just their steps).

Scenarios skipped this way are now recorded, not silently omitted:
suite.skipPickle() inserts a PickleResult and a Skipped PickleStepResult
per step, and both run.go and the BDD test harness in
suite_context_test.go call it instead of just returning/continuing
before the pickle is ever touched. This makes the summary line report
them accurately, e.g. "3 scenarios (1 passed, 1 failed, 1 skipped)"
with their steps counted too, instead of the scenario vanishing from
the totals entirely. fmt_base.go's Summary() gains a scenario-level
skipped bucket (a scenario with only skipped steps and nothing else),
and fmt_junit.go's per-step "skipped" case now actually sets
tc.Status, since it used to rely entirely on a fallback for pickles
with no result at all, which no longer occurs now that skipped
pickles get a real PickleResult.

Also fixes test infra bugs uncovered along the way: testRun() was
hardcoding the tag filter to "@StopOnFailure" instead of using its
tags parameter, which broke unrelated tests (and crashed
Test_FormatterConcurrencyRun outright), and the hardcoded step counts
in Test_AllFeaturesRun/Test_AllFeaturesRunAsSubtests were off by one.
@kcross-ctoken kcross-ctoken changed the title Wire up Options.StopOnFailure to stop the suite on first scenario failure fix(StopOnFailure ): Wire up Options.StopOnFailure to stop the suite on first step and scenario failure Aug 25, 2026
@kcross-ctoken

kcross-ctoken commented Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

@vearutop or @mpkorstanje (active commits recently) Im interested in getting a patch out quickly because its very hard for us to find the failure in a large scenario quickly and efficently. We have a lot of scenarios.

Also Im thinking I would like to become part of the feature/maintenance team as our company uses this a lot so we need promtish support sometimes.
Unfortunately I cant access discord.

@kcross-ctoken kcross-ctoken changed the title fix(StopOnFailure ): Wire up Options.StopOnFailure to stop the suite on first step and scenario failure fix(StopOnFailure): Wire up Options.StopOnFailure to stop the suite on first step and scenario failure Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant