Test design
Тест-дизайн
It’s the process of deciding what to test, which inputs or scenarios to use, and what should happen in each case—without having to try every possibility.
Also known as: классы эквивалентности, граничные значения
What test design is
A requirement tells you what the software should do. Test design turns that requirement into checks you can run. For example, if a shopping cart accepts up to 20 units of a product, you need to decide which quantities to try and what to verify after each attempt. Designing the checks is separate from executing them, and the same design can be used for manual testing or automated tests.
How to choose useful cases
Start with the expected behavior: what is allowed, what should be rejected, and what state should the system be in afterward? If the requirement is vague, clarify it before treating a result as a pass or fail. Then pick a technique that fits the rule:
- Equivalence partitioning groups inputs that should be handled the same way for the rule under test. Choose at least one representative from each group, including invalid groups, rather than testing every value.
- Boundary value analysis targets the edges of ordered groups. It helps catch mistakes such as rejecting the exact maximum or accepting the first value above it.
- Decision tables work well when the outcome depends on a combination of conditions. For example, shipping options may depend on both the destination and the items in the cart.
- State transition testing is useful when the same action has different outcomes depending on what happened earlier. A customer might be able to cancel a pending order but not one that has already shipped.
Example: updating a cart quantity
Suppose an existing cart line holds 3 units. The API accepts whole-number quantities from 1 through 20 and must leave the cart unchanged if it rejects an update. For the numeric range rule, the partitions are below 1, 1 through 20, and above 20. Inputs 0, 8, and 25 give you one case from each: reject and keep 3, accept and save 8, reject and keep 3. Reset the cart before each case so the expected starting state is consistent.
For boundary checks, use 0 and 1 at the lower end and 20 and 21 at the upper end. A test with 8 alone would miss an implementation that accepts quantities only up to 19. A missing value or a fractional quantity isn't another boundary of the integer range. Check the API contract for how those inputs should be handled and test the relevant rules separately.
Common mistakes and interview tips
A list of inputs isn't a complete test: an error response doesn't prove the cart was left unchanged. Also, passing a test for one member of a partition doesn't prove every member works. If some values are handled differently for the behavior under test, reconsider the grouping.
In an interview, expect a short requirement and a request to design a compact set of tests. State your assumptions, show the partitions and boundaries, and give the expected result for each case. If asked what to automate, explain where the rule is best checked: quick function or API tests can cover the range, while a UI test can verify that the rejection is explained clearly to the customer.