Test design techniques in depth
From the basic techniques to coverage, combinations, code coverage and choosing a mix. Every technique ends in a test you could run.
- From test basis to coverage: how much testing is enoughYou cannot test everything, so you count. List the things the tests should touch, find the share that tests have touched, and link each test to the rule it checks.
- How do you know the right answer? Test oraclesA test needs a right answer to compare with. The source of that answer is called an oracle.
- Positive and negative testingTest with the right input to see the normal outcome, then with wrong input to see a safe refusal. The normal route comes first.
- Checklist-based testingA short list of things to check on every screen catches what memory forgets, and costs little to write.
- Equivalence partitioning in depth: when a group is drawn wrongDraw the groups with care. Some groups the software should accept and some it should refuse.
- Equivalence partitioning with several inputsWith several inputs, you can try each choice once or try every mix. The first is cheap and can miss a bad mix. The second is thorough and grows fast.
- Boundary values: two-value and three-value testingList every ordered group, including refused inputs. Test each boundary and its neighbours, then count each chosen value once.
- Boundaries in dates, lengths, lists and sizesAnything with an order has edges: characters in a title, days on a calendar, tasks in a list, bytes in a file.
- Decision tables in depth: merging rulesA decision table can grow fast. When one condition makes no difference to the result, fold the rules into one column. Drop the combinations that can never happen.
- State transition coverage: states, transitions and pathsThere are three ways to say a state model is covered. Visit every state, use every valid move, or try every move in the table, including the forbidden ones.
- Use case testingA use case tells how a person reaches a goal, step by step. Test the usual route first. Then test each detour, such as an error or an option.
- Why combinations explodeEvery new setting multiplies the number of mixes, it does not add to it. Count the mixes before you plan.
- Pairwise testingMost clashes come from two settings meeting, not five. So pick tests until every pair of values has met at least once.
- Error guessing in depth: fault attacksError guessing gets sharper when the guesses are written down. Keep a list of the mistakes that software makes, group it, and aim a test at each one.
- Designing test dataA test is only as good as the data it uses. Build a small set on purpose, with plain values, edge values and odd values, and make it from made-up people, not real ones.
- Testing rules and calculationsMany defects hide in sums. Write the rule down, work the answer out yourself in a different way, and compare.
- Finding testable gaps in requirementsRead each requirement as a tester. Ask whether it can be read two ways, whether a test could say pass or fail, and what nobody wrote down. Ask before the code is built.
- Statement coverageRead the code as a list of steps and count how many steps your tests ran. A count of 100 percent means every step ran once. It does not mean every step was checked well.
- Cause and effect graphsDraw the causes on the left, the effects on the right and join them with AND, OR and NOT. The picture shows what you forgot. Turn it into a decision table to get the tests.
- Testing moves that should not happenA state table lists every state and every event, so the blank cells are the moves that should not happen. Test each blank cell once and check that nothing odd follows.
- Constraints and must-have tests in combinationsTell the pair table which mixes cannot exist and which one you insist on. Then raise the group size from pairs to threes only where the risk is worth the extra tests.
- Classification treesDraw the kinds of input as a tree, with the values at the leaves. Read tests off by picking one leaf from each branch. A table under the tree shows what each test covers.
- Domain testingWhen two or more inputs set the limits together, the allowed values form a region. Test the edge of the region with a value on the fence and a value just across it.
- Branch coverageEvery if in the code has two ways out. Branch coverage counts how many of those ways your tests took. It is a stricter goal than statement coverage.
- Choosing techniques for a featureNo one technique finds everything. Match each part of a feature to the technique that fits its shape, and write down why. Together they cover what each alone would miss.
- One feature, designed with several techniquesTake one feature from requirement to test list. Use partitions, boundaries, a decision table and a state model, then trim tests that repeat and find the rule nobody tested.
- Reviewing test designThe person who wrote the tests has stopped seeing their mistakes. A second reader asks which rule each test covers, and what is missing or repeated.
- Condition coverage and the idea behind modified condition (MC) and decision coverage (DC), known together as MC/DCA check made of several true-or-false parts hides combinations. Three stricter counts look inside it. This lesson stays at the idea and uses one small check.
- Reading code as a list of stepsCode is a list of steps with choices and repeats. A tester who can read ten lines can say which test reaches which line, without writing any code.
- Scenario testing: credible stories that stress the productA scenario test is a believable story of a person using the product, with a twist that strains it. It finds faults that single-feature tests walk past.
- Varying data, sequence, timing and configurationTake a test that passes and change one thing: the data, the order, the timing or the set-up. One test becomes many, and each new test asks a fresh question.
- Test scenarios from activity diagrams and process flowsAn activity diagram draws a process as steps, choices and splits. Tracing every route through it gives a list of test scenarios you can count.
- Pre-conditions, post-conditions and invariantsThree small rules give a tester oracles for free: what must be true before an action, what must be true after it, and what must always be true.
- Testing the mixes the product forbidsSome mixes of settings are not allowed. A tester picks one forbidden mix per rule, checks the product says no in clear words, and checks that nothing was half saved.
- Building pair sets with tools and constraintsBy hand you can build a pair set for three settings. For ten settings you give a tool the model and the banned mixes, then check what it returns.
- Testing money: whole cents, tax and several currenciesMoney has rules that plain numbers do not: whole cents, one rounding rule, tax on lines or on the total, and a different number of decimals for each currency.
- State tables, N-switch coverage and loopsTesting every single move in a state model is a start. N-switch coverage tests chains of moves, and a loop needs a cap so the count stays finite.
- Cyclomatic complexity and basis path testingCyclomatic complexity counts the independent routes through code. That number tells a tester how many tests a basis set needs and how tangled the code is.
- Approval, golden-master and snapshot testingAn approval test compares a big output with a saved copy. It shows what changed, not whether the old copy was right, so a person must review the first copy and each change.
- Metamorphic testing: checking relations when you cannot know the answerWhen you cannot know the right answer, you can still know how two answers must relate. Metamorphic testing checks that relation after a known change to the input.
- From monkey testing to fuzzing, and shrinking a failing inputFeed a program very many odd inputs and watch for crashes. Then cut a crashing input down to a few characters so the cause is easy to see.
- Data-flow testing and def-use coverageFollow one value from where it is set to every place it is read, and test each pair. It finds bugs that full branch coverage can miss.
- Create, read, update and delete testing: checking the whole life of a recordBuild a grid of records against create, read, update and delete. Test each box, then the moments between boxes and what each role may do.
- Domain testing: the four test points and the two coverage criteriaLearn the four kinds of test point on a border. See how a closed border differs from an open one, and how the two coverage criteria count points.
- Combinatorial and random testing: base choice, pairwise and random drawsLearn base choice and pairwise coverage, how to cut a long list of values first, and when and why random testing is worth its limits.
- Decision tables: folding rules, reviewing them and the checksumLearn how to fold a full decision table, check it for gaps and overlaps with the checksum, and when not to fold it at all.
- Selecting techniques to reduce product risk: the factors and the combinationsLearn the factors that decide which technique fits a risk, how risk sets the coverage level, and how techniques are combined.
- Models that find defects in a specification, and automating test designLearn how drawing a model of a specification exposes gaps and clashes. See which defects each model shows, and the gains and risks of generating tests.
- Condition coverage counts: N+1, 2 to the power N, short-circuiting and couplingWork out how many tests modified condition/decision and multiple condition testing need, and see how short-circuiting and repeated variables change the plan.
- Choosing white-box coverage: safety levels, subsumption and API testingLearn how to pick a white-box technique, how coverage criteria rank, what safety levels ask for, and where interface testing fits.
- Static analysis: control flow, data flow and maintainabilityFind control flow and data flow anomalies, work out cyclomatic complexity, and propose ways to make code easier to maintain.