Skip to content

Conversation

@carlos-granados
Copy link
Contributor

No description provided.

Comment on lines 55 to 57
Given I run "behat features/apples.feature"
And I copy "features/apples-fixed.feature" to "features/apples.feature"
When I run "behat features/apples.feature"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think perhaps these initial two "I run" steps should check the result & output (even just the # scenarios (# failed) line) to prove that the scenarios ran / failed as expected prior to the final assertion?

Otherwise for example we don't know for sure that the "fixed" apples feature actually fixed the scenario rather than just removing it, or moving it to a different line number so it doesn't match the rerun cache.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, makes sense, updated

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks - this scenario still doesn't quite make sense to me.

  • We run Behat once at the very beginning of the scenario, which fails (presumably with 2 failing the same as line 13).
  • Then we copy over the file which only changes one example.
  • Then we run without --rerun, and we see that now it fails on one scenario (but runs all the others).
  • And then we run with rerun and see that it only re-runs the failed scenario.

So the only thing we're really proving is that --rerun only re-runs the failed example - but we've already proved that in the "Rerun only failed scenarios" above?

I wonder if this scenario is instead meant to prove:

  • Run the first time runs all scenarios, 2 fail, generates a rerun file
  • Then fix one failure and run with --rerun and now it only runs the 2 that failed the first time, one passes, and it overwrites the rerun file to remove it
  • Then run with --rerun again and now it only runs the scenario that is still failing.

Unless I'm missing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, updated

@carlos-granados carlos-granados force-pushed the refactor-rerun-tests branch 2 times, most recently from 13823c8 to 7cc6b22 Compare December 6, 2025 20:08
Copy link
Contributor

@acoulton acoulton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- Add file copy step to FeatureContext with touch() to bypass cache
- Move rerun test files to tests/Fixtures/Rerun/
- Update rerun.feature to use fixture initialization
- Move common options to Background
@carlos-granados carlos-granados merged commit 113b09f into Behat:3.x Dec 8, 2025
22 checks passed
@carlos-granados carlos-granados deleted the refactor-rerun-tests branch December 8, 2025 19:35
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.

2 participants