-
-
Notifications
You must be signed in to change notification settings - Fork 19
Enhance better-gherkin.md with an additional style #170
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -83,3 +83,36 @@ Scenario: Subscriber with a paid subscription can access both free and paid arti | |
| ``` | ||
|
|
||
| With a declarative style, each step communicates an idea, but the exact values aren't specified. The details of *how* the user interacts with the system, such as which specific articles are free or paid, and the subscription level of different test users, are specified in the step definitions (the automation code that interacts with the system). The subscription packages could change in the future. The business could change what content is available to subscribers on free and paid plans, without having to change this scenario and other scenarios that use the same step definitions. If another subscription level is added later, it's easy to add a scenario for that. By avoiding terms like “click a button” that suggest implementation, the scenario is more resilient to implementation details of the UI. The intent of the scenario remains the same, even if the implementation changes later. In addition, having too many implementation details in a scenario, makes it harder to understand the intended behaviour it illustrates. | ||
|
|
||
| ## In-Between Imperative and Declarative | ||
|
|
||
| There is a style between these two. It demonstrates the logical flow, without the details of the user interface. The data can be used to automate the test the core implementation, as well as used to either manually or automatically test the user interface. | ||
| ```gherkin | ||
| Background: | ||
| Given articles are: | ||
| | Title | For Subscription | | ||
| | Free Article 1 | Free | | ||
| | Paid Article 1 | Paid | | ||
| * Domain Term - Subscriptions are | ||
| | Free | | ||
| | Paid | | ||
|
|
||
| Scenario: Free subscribers see only the free articles | ||
| Given user is logged in | ||
| | User Name | Password | Subscription | | ||
| | [email protected] | validPassword123 | Free | | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are incidental details. Ideally they're kept out of the Gherkin. I wouldn't recommend this to any one.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My original scenario was bad. I just copied the data from the first one. Too fast and not enough thought. There should be a separate scenarios for logging on showing responses for user input variations |
||
| When articles are displayed | ||
| Then articles shown are | ||
| | Title | | ||
| | Free Article 1 | | ||
|
|
||
| Scenario: Subscriber with a paid subscription can access both free and paid articles | ||
| Given user is logged in | ||
| | User Name | Password | Subscription | | ||
| | [email protected] | validPassword123 | Paid | | ||
| When articles are displayed | ||
| Then articles shown are | ||
| | Title | | ||
| | Free Article 1 | | ||
| | Paid Article 1 | | ||
| ``` | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unclear reference. What are "these two"? Something in between "Describing behavior" and "Consider a more declarative style" (the page headings). Or something in between declarative and imperative?
If the latter then this should be under a h3, not a h2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also hope that we don't recommend manual non-exploratory testing 😉 .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the comments. The name was not as descriptive and the reasoning was short. What about something that looked like this.
gherkin better - addition.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not suggesting manual non-exploratory testing. The data could be used as the starting point for exploratory testing.
In some cases, automating UI tests is deferred to later in the development process. The data could be used as for a manual test of the UI in the interim.