Test case design turns requirements and risks into clear examples that can reveal defects. Good test cases explain the behaviour, data and expected result without tying the reader to unnecessary implementation detail.

A practical design flow

  1. Read the test basis. Review the story, acceptance criteria, design, API contract and related risks.
  2. Identify test conditions. List behaviours or risks that need evidence.
  3. Apply design techniques. Select representative partitions, boundaries, rules, states and combinations.
  4. Choose the right level. Decide whether the case belongs at unit, API, integration, UI or exploratory level.
  5. Write observable outcomes. Verify user, API, data and system effects where relevant.
  6. Review for coverage and duplication. Keep cases focused and traceable.
  7. Prioritise. Run critical and high-risk cases first.

Common test design approaches

ApproachBest used forExample
Equivalence partitioningGroups of inputs expected to behave alike.Valid, expired and unsupported coupon.
Boundary value analysisLimits where defects commonly occur.0, 1, 99, 100 and 101 characters.
Decision tablesCombinations of business rules.Role × account state × requested action.
State transitionsBehaviour controlled by current state.Draft → Submitted → Approved.
Pairwise testingLarge configuration combinations.Browser × OS × language.
Use-case or journey testingEnd-to-end user goals.Customer places and tracks an order.
Error guessingExperience, incidents and known weak areas.Double click, refresh during save or stale session.
Exploratory chartersLearning, usability and unexpected interactions.Explore payment recovery under poor network conditions.
Combine techniques: Gherkin structures examples. It does not replace boundary, decision-table or state-transition analysis.

Prioritise Gherkin scenarios

Gherkin expresses behaviour in a shared language using Given, When and Then. It works especially well for acceptance criteria and examples discussed by product, development and QA.

KeywordPurpose
FeatureCapability and its business value.
RuleOne business rule inside the feature.
BackgroundShort setup shared by every scenario. Use sparingly.
ScenarioOne concrete behaviour example.
GivenRelevant starting context.
WhenAction or event under test.
ThenObservable outcome.
And / ButAdditional context, actions or outcomes.
Scenario OutlineSame behaviour with several example rows.

Good Gherkin principles

  • Describe business behaviour, not clicks, selectors or code methods.
  • Keep one main action and outcome per scenario.
  • Use concrete examples and meaningful names.
  • Write steps that a product stakeholder can understand.
  • Keep setup minimal. Mention only context that changes the result.
  • Make outcomes observable and measurable.
  • Do not combine unrelated rules to reduce the scenario count.

Gherkin examples

Clear acceptance scenario

Feature: Apply a discount coupon Rule: A valid coupon reduces the order total Scenario: Customer applies a valid percentage coupon Given the customer has a basket worth €100 And the coupon "SAVE10" provides a 10% discount When the customer applies the coupon Then the order total should be €90 And the applied coupon should be shown in the summary

Scenario Outline for representative values

Scenario Outline: Coupon is rejected when it cannot be used Given the customer has a valid basket And the coupon is When the customer applies the coupon Then the coupon should be rejected And the message should be "" Examples: | coupon_state | message | | expired | This coupon has expired | | already used | This coupon was already used | | for another country | This coupon is not available |

State transition example

Scenario: Approved order cannot return to draft Given order "ORD-123" is approved When an editor requests to return the order to draft Then the request should be rejected And order "ORD-123" should remain approved And the rejected action should be recorded in the audit log

What to avoid in Gherkin

# Too technical and fragile Scenario: Login Given I navigate to "/login" When I fill "#email" with "qa@example.com" And I click ".primary-button" Then the URL contains "/dashboard" # Better: behaviour-focused Scenario: Registered user signs in Given Ana has an active customer account When Ana signs in with valid credentials Then Ana should see her customer dashboard
  • Avoid long scripts with many And steps.
  • Avoid vague results such as “it works” or “success is shown”.
  • Avoid using Scenario Outline as a spreadsheet for unrelated cases.
  • Avoid repeating UI navigation in every scenario.
  • Avoid automating every written scenario at the UI level.

Detailed test case fields

Gherkin can be the main behaviour specification while metadata records execution details.

FieldPurpose
ID and titleStable reference and clear behaviour name.
Requirement / riskWhy the case exists.
PriorityExecution order based on impact and likelihood.
Level and typeAPI, UI, integration, regression, security and so on.
PreconditionsRequired state that is not part of the action.
DataExact values or method for generating them.
ScenarioGherkin or concise actions and outcomes.
Expected side effectsDatabase, audit, email, event or external-system result.
Automation statusManual, candidate, automated or not suitable.
EvidenceReport, screenshot, trace or execution link.

Copy-ready test case template

# Test Case — [ID]: [Behaviour title] Requirement / story: [Link or ID] Product risk: [Risk controlled by this case] Priority: [Critical / High / Medium / Low] Test level: [Unit / Component / API / Integration / UI / E2E] Test type: [Functional / Regression / Security / Accessibility / Other] Execution: [Manual / Automation candidate / Automated] Owner: [Role or name] ## Preconditions - [Required user, system and data state] - [Required feature flag or dependency] ## Test data | Field | Value / generation rule | |-------|-------------------------| | [Field] | [Value] | ## Scenario Feature: [Capability] Rule: [Business rule] Scenario: [Concrete behaviour] Given [relevant initial context] And [additional context only when needed] When [single main action or event] Then [observable primary result] And [important secondary result] ## Expected technical effects - API: [Status, contract or request] - Data: [Stored or unchanged state] - Events / messages: [Expected event] - Audit / logs: [Expected record] - Notifications: [Expected message] ## Cleanup - [Data or state to restore] ## Traceability Related regression suite: [Suite / tag] Related defects: [Links] Automation test: [Path / link] Last reviewed: [Date] ## Execution result Build / environment: [Details] Result: [Pass / Fail / Blocked / Not run] Evidence: [Links] Notes / defect: [Details]

Lightweight story template

For normal sprint work, a smaller version is often enough:

Scenario: [Business behaviour] Risk: [Why this matters] Priority: [H/M/L] Given [context] When [action] Then [observable outcome] Data: [Values] Level: [API/UI/etc.] Automation: [Yes/No/Later] Evidence: [Link after execution]

Review checklist

  • Each case traces to a requirement, rule or risk.
  • Positive, negative, boundary, role and state cases are considered.
  • Gherkin describes behaviour rather than interface mechanics.
  • Expected results are specific and observable.
  • Test data is clear, safe and repeatable.
  • The test runs at the lowest sensible level.
  • Cases are independent or document their dependency.
  • Duplicate cases are removed.
  • Priority reflects risk, not creation order.
  • Automation is chosen for value and stability.

Useful links