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

Add support for rules #38

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

just95
Copy link

@just95 just95 commented Aug 15, 2022

As of Gherkin 6 multipleScenarios can be grouped using Rules. The check-cucumber tool currently does not support the Rule keyword and thus cannot find scenarios in rules. This PR adds support for the import of scenarios from rules into Testomatio.

The main change is in getScenarioCode: when the child of a feature is a rule, the children of the rule are processed recursively.
Additionally the calculation of a scenario's end position had to be updated. Previously the end position was defined as the start position of the next child or the end of the source in case of the last child. Now there is the additional case that the last child of a rule is followed by another rule. To generalize all cases, the start positions of all rules and scenarios are calculated in a preprocessing step using getLocations. The end positions are then calculated from the start positions.

I also added an example and corresponding test cases. The tests ensure that all scenarios in rules are found and that the correct code fragment is extracted.

just95 added 4 commits August 8, 2022 14:31
A `Rule` cannot be the child of another rule. Thus, the check if
we are `inRule` is not needed. If nested rules were allowed in the
future, more than a single space of indentation would be needed
anyway.
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