Industry-relevant training in Business, Technology, and Design to help professionals and graduates upskill for real-world careers.
Fun, engaging games to boost memory, math fluency, typing speed, and English skillsβperfect for learners of all ages.
Enroll to start learning
Youβve not yet enrolled in this course. Please enroll for free to listen to audio lessons, classroom podcasts and take practice test.
Listen to a student-teacher conversation explaining the topic in a relatable way.
Signup and Enroll to the course for listening the Audio Lesson
Today, we will discuss Gherkin language, which is essential for writing acceptance criteria in a clear and manageable format. Can anyone tell me what acceptance criteria are?
Acceptance criteria are the conditions that must be met for a user story to be considered complete.
Exactly! Now, Gherkin aids in outlining these criteria in a structured way. Remember the keywords: Given, When, Then, and And. These help in framing our thoughts clearly.
So, does that mean each user story can have multiple Gherkin scenarios?
Yes! Multiple scenarios can help capture different aspects of a user story. Who can summarize the purpose of the Given, When, and Then keywords?
Given sets up the context, When describes the action, and Then defines the expected outcome.
Great summary! Remember how each keyword plays a role in ensuring clarity in communication among the team and stakeholders.
Signup and Enroll to the course for listening the Audio Lesson
Let's look at an example of Gherkin syntax related to a password reset feature. Who can read this example for us?
"Feature: Password Reset, Scenario: Successful password reset request, Given the user is on the login page, And the user clicks on 'Forgot Password', When the user submits their registered email address, Then a reset link should be sent to that email, And the link should expire in 24 hours."
Well done! This scenario clearly outlines the process for the user and expectations. Why do we use phrases like 'should be sent' in the Then part?
To show the expected result of the action taken.
Correct! Using clear language helps everyone understand what the feature should deliver. Let's practice writing another scenario together!
Signup and Enroll to the course for listening the Audio Lesson
Gherkin helps in ensuring that everyone has a shared understanding of the acceptance criteria. Why is this important?
It's important because it minimizes misunderstandings between the development team and stakeholders.
Exactly! And when everyone agrees on the criteria, it streamlines the development process. What happens if we donβt have clear acceptance criteria?
It could lead to misinterpretations of what needs to be developed.
Right! Let's summarize by throwing out a quick definition of Gherkin for our notes.
Gherkin is a structured language for writing acceptance tests in a readable format focused on Given, When, and Then.
Read a summary of the section's main ideas. Choose from Basic, Medium, or Detailed.
This section introduces Gherkin language, which helps in defining acceptance criteria using a GivenβWhenβThen format. It emphasizes the importance of clear, readable criteria for successful acceptance testing and project communication.
Gherkin is a domain-specific language designed for Behavior-Driven Development (BDD) to write acceptance tests in a structured format. It follows a simple syntax that consists of keywords such as Given, When, Then, and And, which lay out scenarios regarding how the end user will interact with a feature.
Feature: Password Reset Scenario: Successful password reset request Given the user is on the login page And the user clicks on "Forgot Password" When the user submits their registered email address Then a reset link should be sent to that email And the link should expire in 24 hours
This structured approach improves the clarity of acceptance criteria, aids communication among stakeholders, and ensures that every user story can be effectively validated against these criteria, promoting alignment between business needs and development output.
Dive deep into the subject with an immersive audiobook experience.
Signup and Enroll to the course for listening the Audio Book
Gherkin is a structured language used in Behavior-Driven Development (BDD) to write acceptance tests in a readable GivenβWhenβThen format.
Gherkin language simplifies the process of writing tests by providing a clear structure that anyone can understand, regardless of their technical background. It uses the Given-When-Then format to outline conditions (Given), actions (When), and outcomes (Then). This approach helps ensure that both stakeholders and developers have a shared understanding of what is being built and how it should behave.
Think of Gherkin like a recipe. The 'Given' part tells you what ingredients you have (the initial conditions), the 'When' part explains what steps to take (the actions), and the 'Then' part describes what the final dish should look like (the expected outcome). Just as a recipe makes cooking easier for everyone, Gherkin makes understanding requirements easier for teams.
Signup and Enroll to the course for listening the Audio Book
π§© Gherkin Syntax:
K Purpose
key
word
Gi Precondition or setup
e
n
W Action or event
h
e
n
T Expected outcome
h
e
n
A Additional steps in sequence
The Gherkin syntax consists of several keywords that help structure acceptance criteria. Each keyword serves a specific function: 'Given' sets up the initial context or state, 'When' describes the action taken, 'Then' states the expected result after performing the action, and 'And' is used to add more steps in the sequence. Understanding these keywords is essential for writing clear and effective acceptance tests.
Imagine telling a friend about your day in a structured way: 'Given I woke up early, When I made breakfast, Then I felt energized.' Each part builds on the previous one to paint a complete picture of your story, similar to how Gherkin structures test scenarios.
Signup and Enroll to the course for listening the Audio Book
π Gherkin Example (Password Reset)
Feature: Password Reset
Scenario: Successful password reset request
Given the user is on the login page
And the user clicks on "Forgot Password"
When the user submits their registered email address
Then a reset link should be sent to that email
And the link should expire in 24 hours
This example outlines a feature for resetting a password with a clear, structured approach. The 'Feature' line states what is being testedβpassword resets. The 'Scenario' gives a specific situation to test for success. The 'Given' lines set the stage, explaining where the user needs to be (login page) and what actions they take (clicking forgot password). The 'When' part describes the user's action of submitting their email, and 'Then' describes what should happen as a result: receiving a reset link that expires within 24 hours.
Think of this example like a script for a play. The 'Feature' sets the scene, and each line of the script (Given, When, Then) corresponds to what the actors need to do and when. In our case, the actors are the user and the system responding to the user's actions in a specified sequence.
Learn essential terms and foundational ideas that form the basis of the topic.
Key Concepts
Gherkin Language: A structured way to define acceptance criteria for user stories.
Given-When-Then Format: A specific structure that dictates how to outline scenarios clearly.
Acceptance Criteria: Conditions for user stories that define what must be done for the story to be complete.
See how the concepts apply in real-world scenarios to understand their practical implications.
Feature: Password Reset Scenario: Successful password reset request Given the user is on the login page And the user clicks on "Forgot Password" When the user submits their registered email address Then a reset link should be sent to that email And the link should expire in 24 hours.
Use mnemonics, acronyms, or visual cues to help remember key information more easily.
Given is the state where you start, When is the action playing its part, Then is the end, a goal you impart.
Imagine a user who wants to reset a password; they log in, click a link, enter their email, and receive a reset linkβthis sequence illustrates the Gherkin process.
GWT: Get When Thenβthis reminds you of the three Gherkin components.
Review key concepts with flashcards.
Review the Definitions for terms.
Term: Gherkin
Definition:
A structured language used in Behavior-Driven Development (BDD) for writing acceptance scenarios in a clear, readable format.
Term: Acceptance Criteria
Definition:
Conditions that must be met for a user story to be considered complete and acceptable.
Term: BehaviorDriven Development (BDD)
Definition:
An Agile software development technique that encourages collaboration among developers, QA, and non-technical or business participants.
Term: GivenWhenThen
Definition:
The structure used in Gherkin to outline scenarios, where 'Given' provides context, 'When' describes the action, and 'Then' defines the outcome.