Learn to write and discuss Gherkin scenarios: Given, When, Then, Scenario Outline.
0 / 10 completed
1 / 10
In Gherkin, what does 'Given' describe?
'Given' describes the pre-existing state or context: 'Given a user is logged in', 'Given there are 5 items in the shopping cart'. It sets up the world before the action.
2 / 10
What does 'When' describe in a Gherkin scenario?
'When' describes the action or event: 'When the user clicks Submit', 'When the payment is processed'. It triggers the behaviour being tested.
3 / 10
What does 'Then' describe in a Gherkin scenario?
'Then' describes the expected outcome: 'Then the user sees a success message', 'Then the account balance decreases by £10'. It asserts the result of the 'When' action.
4 / 10
What is a 'Scenario Outline' in Gherkin?
A Scenario Outline is a parameterised scenario using angle-bracket placeholders (e.g., ). It runs once per row in the Examples table, with each row's values substituted.
5 / 10
What is a 'Background' section in a Gherkin feature file?
A Background section contains Given steps that are run before every scenario in the feature file — used for common setup (e.g., 'Given a user is logged in') to avoid repeating it in every scenario.
6 / 10
Code Review Comment: During a code review of the user authentication service, Sarah comments to David: 'This step could be more explicit. Instead of just saying 'User logs in', consider adding what happens after the login – like, does it redirect them to the dashboard?' What Gherkin keyword best represents this suggestion?
This comment highlights the need to define *what happens next* after the user logs in. The 'Given' keyword in Gherkin is precisely used to establish the initial state and preconditions for a scenario – setting up the context before an action occurs. Options B and C are incorrect because they relate to 'When' (the action) and 'Then' (the outcome), while option D describes a general assertion.
7 / 10
Slack Message: Liam sends the following message to the team channel: 'We need to add a scenario for handling invalid API keys. The current feature doesn't cover this edge case.' Which Gherkin concept does Liam primarily discuss?
Liam is referring to a situation where the system needs to handle an *exception* – an invalid API key. 'Scenario Outline' is designed for testing different variations of input data and parameters within a scenario, which isn't directly relevant here. The 'Given' keyword would be used to set up the initial state with a valid (or potentially invalid) API key.
8 / 10
PR Description: You're preparing a pull request for a new feature that allows users to reset their passwords. The description includes the following: 'This PR implements the logic to send a password reset email when a user requests one.' What Gherkin element does this description most closely align with?
The description clearly outlines the *initial condition* – a user requesting a password reset. The 'Given' keyword in Gherkin is specifically used to define this prerequisite state before any action (the sending of an email) can take place. Options B and C are incorrect because they relate to shared setup or the initial story context, and option D refers to code implementation.
9 / 10
API Response: The following JSON response represents a successful user login. `{"status": "success", "user_id": 123, "token": "abcdefg"}`. What Gherkin keyword would be used to describe the *successful* outcome of this API call in a scenario?
The API response indicates a *successful* login. The 'Then' keyword is used in Gherkin to verify that the expected outcome has been achieved after the action (the login) has occurred. This confirms the desired state – the user is authenticated and a token is returned. Options B and C are incorrect because they relate to setting up the initial state or describing the action itself.
10 / 10
Standup Update: During the daily standup, Mark says, 'I'm working on writing Gherkin scenarios for the new payment processing feature. I've started with the steps to create a new order.' What is Mark primarily focused on?
Mark is describing the process of defining the *initial conditions* for a new user story – creating a new order. The 'Given' keyword in Gherkin is used to establish this foundational state before any actions are performed within the scenario (e.g., adding items to the cart, processing the payment). Options B and C describe shared setup or initial context, while option D relates to code implementation.
What will I learn from the "Gherkin Scenario Writing — BDD Vocabulary" exercise?
Learn to write and discuss Gherkin scenarios: Given, When, Then, Scenario Outline.
Is this exercise free to use?
Yes. Every exercise on CoderSlingo, including this one, is free to use with no account, sign-up, or paywall required.
How many questions are in this exercise?
This set contains 10 multiple-choice questions, each with a detailed explanation shown after you answer.
Do I need to create an account to track my progress?
No account is required. Your progress bar and score reset each time you reload the page, but you can retry the exercise as many times as you like.
Who is this TDD/BDD Language exercise for?
This exercise is built for IT professionals and non-native English speakers who need to read, write, and discuss tdd/bdd language topics confidently at work.
What happens if I answer a question incorrectly?
You will see the correct answer highlighted along with a detailed explanation of why it is correct -- so every wrong answer becomes a learning moment, not just a lost point.
Can I retry this exercise?
Yes -- click "Try again" on the results screen at any time to reset your score and go through all the questions again.
How long does this exercise take to complete?
Most learners finish all 10 questions in under 10 minutes, since each question is answered by clicking a single option.
Where can I find more TDD/BDD Language exercises?
See the full TDD/BDD Language exercises hub for more vocabulary drills on this topic.
Is this exercise mobile-friendly?
Yes -- the exercise works on any device with a modern browser, including phones and tablets, with no app download required.