KNOWLEDGE / 02
Test design
Test design techniques, risk modelling, and building useful test coverage.
Questions and practice
Open a question to see the answer, examples, and exercises.
Why use equivalence partitioning?Junior
Answer
It divides input data into classes expected to behave alike, reducing the number of checks.
Examples
- For an age field accepting 18–65, test representatives of the valid class and the classes below and above the limits.
Practice exercises
- For a quantity rule of 1–99, identify equivalence classes and choose representatives.
How does boundary value analysis work?Junior
Answer
Boundary Value Analysis checks values at the edge of an allowed range and immediately around it because comparison and rounding defects often appear there. For a range of 1–100, a basic set includes 0, 1, 2, 99, 100, and 101, but real boundaries may also depend on data types and business rules.
Examples
- A ticket quantity accepts 1 through 10, so we check 0, 1, 2, 9, 10, and 11.
Practice exercises
- Identify the boundaries for a booking date from today through 90 days and create a minimal test set.
When is error guessing useful, and what does it not replace?Junior
Answer
Error guessing applies experience with common failures such as empty values, repeated actions, invalid formats, timeouts, or state changes between steps. It is fast and complements formal design, but its coverage depends on the tester’s experience, so it does not replace systematic requirement and risk analysis.
Examples
- For a payment form, check a double click, browser Back after confirmation, and resubmitting the request.
Practice exercises
- Create ten error-guessing ideas for file upload and group them by risk source.
When is a decision table useful?Middle
Answer
When an outcome depends on combinations of conditions and business rules.
Examples
- A discount may depend on the user role, order total, and promo code at the same time.
Practice exercises
- Build a decision table for a discount based on role, total, and promo code.
How do you design tests for a state machine?Middle
Answer
Start by identifying states, events, allowed transitions, and guard conditions. Then test valid paths, forbidden transitions, repeated events, recovery after failure, and state reachability. Verify not only the final status but also every transition’s side effects.
Examples
- An order may move Draft → Paid → Shipped, while Draft → Shipped must be rejected without creating a shipment.
Practice exercises
- Model the states of a password-reset token and test expiry, reuse, and cancellation.
What makes exploratory testing manageable?Middle
Answer
Exploratory testing combines learning, test design, and execution within a session. A charter with a focus and risk, a timebox, notes about coverage and findings, and a short debrief make it manageable. It is adaptive investigation with visible outcomes, not random clicking.
Examples
- Charter: explore checkout recovery after network loss, focusing on duplicate charges, cart state, and user messages.
Practice exercises
- Write a 30-minute charter for accessibility risks in a registration form and define the session evidence.
Does pairwise testing guarantee an absence of defects?Senior
Answer
No. It covers pairs of factor values but may miss interactions among three or more factors.
Examples
- A defect may occur only for Safari, a guest user, and one currency together.
Practice exercises
- Take four checkout factors and explain which risk remains after a pairwise set.
When is property-based testing stronger than example-based tests?Senior
Answer
Property-based testing generates many inputs and checks general invariants instead of a few predefined answers. It works well for parsers, transformations, serialization, and mathematical rules. Its value depends on sound properties, generators, and shrinking; a wrong property only scales false confidence.
Examples
- After serialize → deserialize, an object should preserve its meaningful fields across a broad set of generated values.
Practice exercises
- Define three properties for sorting and explain which defects a check for sorted output alone would miss.
What does model-based testing provide, and where are its limits?Senior
Answer
Model-based testing derives scenarios from an abstract model of states, rules, or flows. It systematically covers transitions and can generate sequences that are hard to design manually. The model is another artefact with its own defects and maintenance cost, so its value depends on domain stability and the importance of coverage.
Examples
- A subscription protocol model generates activation, pause, resume, cancellation, and forbidden transition paths.
Practice exercises
- Compare a manual scenario set with a state model for document approval and estimate the maintenance cost.