Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore support for matching a scenario by its tags' and steps' line numbers. #238

Merged

Conversation

botandrose
Copy link
Contributor

@botandrose botandrose commented Aug 16, 2022

Description

The Cucumber 4.0 release introduced some regressions in matching scenarios by line numbers other than the exact scenario line. The feature line, tag line, background lines, and step lines all stopped matching their related scenario(s). More context at cucumber/cucumber-ruby#1469

This PR is the first step towards restoring that functionality, and only restores the tags and step lines being matched. It also restores the old tests that used to cover all the matching functionality, pending the ones that still need implementation work.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • Tests have been added for any changes to behaviour of the code
  • New and existing tests are passing locally and on CI
  • bundle exec rubocop reports no offenses
  • RDoc comments have been updated
  • CHANGELOG.md has been updated

@botandrose botandrose force-pushed the fix_cli_line_number_regressions_better branch from 45c136a to 0290bb0 Compare August 16, 2022 15:43
@botandrose botandrose changed the title Restore support for matching a scenario by its steps' line numbers. Restore support for matching a scenario by its tags' and steps' line numbers. Aug 16, 2022
@botandrose
Copy link
Contributor Author

Okay, this PR matches tags as well. It was just too simple to add.

Gonna leave this PR as-is for now, because I'm expecting to do a followup PR to match multiline args (tables and docstrings) again... this is a medium amount of work, but still pretty localized.

Comments, feature declaration lines, and background steps appear to require modification to the pickles compiler, so I'm going to save that for last.

@luke-hill
Copy link
Contributor

Where are we at with this PR, would you like it reviewed / considered for merge?

Do you think a sibling PR that adds some more rigorous test cases in cucumber-ruby would be good, so we don't regress again. Whereby we run a scenario from each of the fixed items here (tags / feature keyword / steps).

Happy to help where appropriate or defer items. Just wanting to get the lay of the land so to speak

@botandrose
Copy link
Contributor Author

@luke-hill hi! Yes, sorry, I see that what I said was rather ambiguous! I would indeed like this PR to be reviewed for merge. It fixes the majority of the regression with a simple change, and it's very localized.

Once this is merged, I plan to follow up with more PRs, here and in other repos to fill in the rest of the gaps. And yes, that will incude one in cucumber-ruby verifying the regression is fixed from the outside. I already have a branch for that pushed, even, so I'm already partly there.

So yeah, take a look and let me know what you think of this PR! Thank you for your time.

Copy link
Contributor

@luke-hill luke-hill left a comment

Choose a reason for hiding this comment

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

Didn't review the spec from 273 downwards as there's likely some duplicate comments.

Great stuff though.

One question about xit - We don't have this standard here. I don't foresee an issue too much if the turnaround time is reasonably quick. But it might be a case where we just don't commit these tests.

CHANGELOG.md Outdated Show resolved Hide resolved
lib/cucumber/core/test/case.rb Show resolved Hide resolved
spec/cucumber/core/test/filters/locations_filter_spec.rb Outdated Show resolved Hide resolved
spec/cucumber/core/test/filters/locations_filter_spec.rb Outdated Show resolved Hide resolved
spec/cucumber/core/test/filters/locations_filter_spec.rb Outdated Show resolved Hide resolved
spec/cucumber/core/test/filters/locations_filter_spec.rb Outdated Show resolved Hide resolved
spec/cucumber/core/test/filters/locations_filter_spec.rb Outdated Show resolved Hide resolved
spec/cucumber/core/test/filters/locations_filter_spec.rb Outdated Show resolved Hide resolved
spec/cucumber/core/test/filters/locations_filter_spec.rb Outdated Show resolved Hide resolved
@botandrose
Copy link
Contributor Author

@luke-hill Thank you for the review! I just pushed another commit with the requested changes made. I also removed all the pending specs, to be reintroduced in follow-up PRs when they are passing.

What do you think? Ready to merge?

@botandrose
Copy link
Contributor Author

As I was working on some of the follow-up work to this PR, I realized that this PR also gets us background step matching for free, so I just pushed another commit that adds test coverage.

@luke-hill
Copy link
Contributor

luke-hill commented Aug 23, 2022

Next steps (For my benefit).

Merge this
Release this
Update cucumber ruby (Add new test cases in cucumber ruby to prevent regression)
Merge cucumber ruby update
Release new cucumber ruby

@botandrose let me know if you agree with next steps.

@botandrose
Copy link
Contributor Author

Hi Luke, thanks for taking a look and approving the PR! Your next steps look great to me, and I'd like to insert an additional step:

Merge this
-->Merge in an additional PR covering matching locations on multiline arguments<--
Release this
Update cucumber ruby (Add new test cases in cucumber ruby to prevent regression)
Merge cucumber ruby update
Release new cucumber ruby

This additional multiline matching PR is ready to be submitted for review, but I was waiting on this one here to get merged, since the new PR builds on top of it.

@luke-hill luke-hill merged commit b9be5fc into cucumber:main Aug 23, 2022
@aslakhellesoy
Copy link
Contributor

Hi @botandrose,

Thanks for your making your first contribution to Cucumber, and welcome to the Cucumber committers team! You can now push directly to this repo and all other repos under the cucumber organization! 🍾

In return for this generous offer we hope you will:

  • ✅ Continue to use branches and pull requests. When someone on the core team approves a pull request (yours or someone else's), you're welcome to merge it yourself.
  • 💚 Commit to setting a good example by following and upholding our code of conduct in your interactions with other collaborators and users.
  • 💬 Join the community Slack channel to meet the rest of the team and make yourself at home.
  • ℹ️ Don't feel obliged to help, just do what you can if you have the time and the energy.
  • 🙋 Ask if you need anything. We're looking for feedback about how to make the project more welcoming, so please tell us!

On behalf of the Cucumber core team,
Aslak Hellesøy
Creator of Cucumber

@botandrose botandrose deleted the fix_cli_line_number_regressions_better branch August 23, 2022 08:28
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.

4 participants