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
Open
Conversation
kcross-ctoken
force-pushed
the
stop-on-failure
branch
from
August 25, 2026 15:06
a71e4bc to
e88b865
Compare
…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
force-pushed
the
stop-on-failure
branch
from
August 25, 2026 15:25
e88b865 to
2e7da69
Compare
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤔 What's changed?
stopOnFailureinto the per-pickle suite copy inrun.goso it reaches suite-level hook handling, and stops running remaining before-step hooks once one has failed.features/events.featureproving that once a scenario fails withStopOnFailureenabled, later scenarios in the run are skipped entirely (not just their steps).suite.skipPickle()inserts aPickleResultand aSkippedPickleStepResultper step, and bothrun.goand 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'sSummary()gains a scenario-levelskippedbucket (a scenario whose steps are all skipped, i.e. it never ran).fmt_junit.go's per-stepskippedcase now actually setstc.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.