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
extend support for 'rule' sections in features #121
base: main
Are you sure you want to change the base?
Conversation
88faaeb
to
b626c9b
Compare
Indeed, it’s true that when using “the one where” technique with scenario names summarizing the given steps, it’s not uncommon to see the same scenario names when the given steps are repeated, which would break the validation as of now. I can also see where allowing rules to be defined along with scenarios in the step definitions would be very “Jest-like”. We would probably want validation errors when rules aren’t defined, as well as code generation for rules and the scenarios within. Rather than introducing a new
Here are some additional thoughts:
Thoughts? |
3797684
to
cb7c122
Compare
I refactored the PR to get rid of What do you think of my changes? |
Overall, nice work so far! Sorry, a lot going on the last couple of days—still looking over the code and will be doing some regression testing. Looks like this gets us most of the way there, with some extra refactoring and code improvements I see. |
Sorry for the long wait, and I thought I’d provide an update. Since this PR touches a good portion of the functionality in this library, and since there are already open issues reporting regressions from previous releases, I thought now would be a good time to take a step back and look at the testing strategy of this library. As I started writing down scenarios to manually regression test the changes in PR, I came to the realization that I was basically writing rules and scenarios, and that I might as well create an exhaustive set of feature files for this library. It also occurred to me that it should be possible to create automated integration tests for this entire library by mocking out Jest via dependency injection, which would include basically wrapping the code in It would probably be best to defer integration tests until after this upcoming release to keep the open work in progress at a minimum. Yesterday, I got most of the feature files written with about 80 scenarios so far and a couple more feature files to go. I have pushed up a copy of your extended-rule-support branch, and should be adding the feature files today. I’ll then go through and manually test every scenario and add a comment about the outcome to every scenario. The failed tests related to this PR (including functionality that is a WIP or any regressions) would be in scope to address right away, and any other existing bugs discovered would be addressed later as part of the work of getting the integration tests to pass. |
@bencompton I've come across the validation issue since I use the example mapping technique (Story/Rule/Example) and had a duplicate scenario title. Funnily enough, I came across the issue once I had done my initial experimental port of jest-cucumber over to web-test-runner/mocha (https://github.com/rquast/gherkin-testkit). I'll incorporate this PR into the experiment as I kind of need to work with this straight away for my other project. Have you had more time to think about cross framework compatibility? |
The As I was regression testing this PR, there were some overall issues with the validation logic, and there were already some issues with it in master. So, I ended up creating that integration-tests branch to get integration tests all passing on master prior to pulling in this PR and adding additional integration tests and fixes. I've gotten side-tracked the last couple of weeks, but once all of this is caught up, it should be possible support other libraries. Semantically, it might be odd to consume a library called Jest Cucumber for other runners like Mocha, so I haven't determined the best way to accomplish that yet. |
Thanks for the info. Yes, seems odd for one runner to consume something called jest-cucumber, but I guess you're also consuming @cucumber/gherkin from the cucumber runner. ;) |
See #120