Great work!

XP to next level

BugEater

How the Gherkin Scenario Builder Works

Learning Objectives

By the end of this lesson you will be able to:

  • Navigate the Gherkin Scenario Builder interface confidently
  • Read a Given/When/Then scenario and understand what each keyword signals
  • Understand what each result option (Number, User input error, Application error) means in the context of a scenario
  • Know exactly when XP and your badge are awarded

What Makes This Challenge Different

In the Test Case Generator, you selected two inputs and a result. The Gherkin Scenario Builder does the same thing — but wraps those selections inside a structured BDD scenario that builds as you choose. Instead of isolated dropdowns, you see the full story:

A Given line establishes context. A When line describes an action. A Then line states the expected outcome.

By the time you click Validate Scenario, you haven't just picked values — you've written a test scenario in the same language that QA teams share with developers and product managers every day.

The Gherkin Scenario Builder Interface

The screen is organized into three zones:

  • A top progress row with seven dots, where each dot represents one test case
  • A left-side scenario builder where each row is a Gherkin keyword — Given, When, And, Then — with inline dropdowns for the two input values and the expected result
  • A right-side read-only preview panel showing the form being tested with the currently selected values

As you change your selections, the scenario on the left updates live, and the mock form on the right mirrors your choices.

The Gherkin Keywords

Each line in the scenario has a purpose:

Keyword Role
Given Sets up the precondition — the state the system is in before the action
When Describes the action being taken — what the user does
And Continues the previous step's story — more context, more actions
Then States the expected outcome — what should happen as a result

You don't need to master the theory of BDD scenario writing yet — that's covered in future courses. For now, focus on reading the scenario line by line and selecting the values that complete it correctly.

The Three Result Options

Just like in the Test Case Generator, your expected result is one of three:

Result Meaning
Number The subtraction succeeds and returns a numeric result
User input error The input is invalid — text where a number is expected, or an empty field — and the form should reject it
Application error The input looks like a valid number but causes the application to behave unexpectedly — an overflow, unhandled edge case, or crash

Pro Tip: The difference between "User input error" and "Application error" is who is responsible. If the input is obviously wrong (letters, empty), the form catches it — that's a user input error. If the input sneaks past validation but breaks the calculation, the application failed — that's an application error.

The Testing Techniques Behind the Cases

The 7 test cases in the Number Subtraction challenge use the same three techniques from the Test Case Generator module — just applied to a subtraction form:

  • Equivalence Partitioning — one representative input from each class of valid and invalid values
  • Boundary Value Analysis — inputs at the edges of acceptable ranges
  • Error Guessing — inputs likely to expose defects: empty fields, alphabetic strings, extremely large numbers

These techniques will be fully explained in future courses. For now, recognizing that these patterns exist is enough.

Reading Feedback After Each Submission

When you click Validate Scenario:

  • All rows turn green — your scenario is correct. The case is marked complete and you advance to the next one.
  • One or more rows turn red — a specific dropdown was wrong. Correct it and try again.

No penalty for incorrect attempts. The practice is your learning space.

When Are XP and the Badge Awarded?

XP and the "Number Subtractor" badge are awarded only when you complete all 7 test cases. There is no partial reward.

Completing this challenge earns you 8 XP.

Pro Tips

  • Read each Gherkin line in sequence before touching a dropdown. The scenario tells you what value belongs where.
  • Use the mock form preview on the right to visualize the state of the form before submitting.
  • If you're stuck on the result, ask: "Would a well-written form even let this value reach the calculation?" If yes — it's an application error.
  • Completed cases stay marked — you can review earlier ones via the progress dots at any time.

What's Next

You now know how to read and complete a Gherkin scenario. Open the Number Subtraction challenge and work through all 7 cases. The "Scenario Architect" badge awaits.

Quiz

Which Gherkin keyword describes the action a user takes?

Which result option should you select when an input looks like a valid number but causes an overflow or crash in the application?

When are XP and the "Number Subtractor" badge awarded?

How many test cases does the Number Subtraction challenge contain?