12.3.5 Test Strategies, Test Plans and Test Data
A large program cannot realistically be checked with every possible input, configuration and sequence of actions. Testing therefore needs to be planned so that important requirements, components, paths, interfaces and user activities receive suitable attention.
A test strategy defines the overall approach. A test plan turns that approach into repeatable test cases containing exact data and predicted results. Carefully selected normal, abnormal and extreme or boundary values help the tester examine different kinds of behaviour without trying every possible value.
By the end of this section, you should be able to:
- Explain why systematic testing needs an overall strategy.
- Distinguish between a test strategy, a test plan and a test case.
- Describe likely contents of a test strategy and test plan.
- Connect test cases to requirements and identified risks.
- Distinguish normal, abnormal and extreme or boundary data.
- Select exact values for range, type, format and length rules.
- State an expected result before a test is executed.
- Record actual results, outcomes, faults and retests clearly.
Why Testing Must Be Systematic
Unplanned testing often concentrates on the easiest or most familiar parts of a program. Important requirements may receive no test at all, while the same successful route is repeated several times.
| Problem with informal testing | How planning helps |
|---|---|
| Only typical successful inputs are tried. | Different data categories and failure cases are selected deliberately. |
| Some requirements are forgotten. | Every test is linked to a requirement or testing objective. |
| The expected result is decided after the program runs. | Expected behaviour is written before execution. |
| Different testers perform different steps. | Preconditions, data and actions are documented precisely. |
| A failed test cannot be reproduced. | The environment, version, data and actual result are recorded. |
| Corrections are not checked properly. | Failed tests and related regression tests are scheduled again. |
Test Strategy
The strategy provides direction for the whole testing process. It should be considered while the system is being analysed and designed rather than being invented only after coding is complete.
A strategy answers broad questions:
- Which parts of the system are included in testing?
- Which requirements or risks are most important?
- Which testing methods will be used?
- At which development stages will tests occur?
- Who is responsible for each type of testing?
- Which devices, operating systems or configurations are needed?
- What evidence will be recorded?
- What must be true before testing starts or finishes?
Likely Contents of a Test Strategy
| Strategy area | Question answered | Observatory example |
|---|---|---|
| Objectives | What confidence should testing provide? | Demonstrate that bookings obey capacity, duration and participant rules. |
| Scope | Which features are included or excluded? | Include booking, cancellation and retrieval; exclude the future payment service. |
| Risk and priority | Which failures would have the greatest effect? | Prevent overbooking and duplicate booking references. |
| Methods | Which testing methods are suitable? | Module, integration, black-box, alpha and acceptance testing. |
| Stages and sequence | When will each type of testing occur? | Test validation modules first, then booking integration and complete user journeys. |
| Test environment | Which hardware and software configurations are needed? | Supported desktop and mobile browsers with a separate test database. |
| Responsibilities | Who prepares, executes and reviews tests? | Developers test modules; the quality team tests the integrated portal; observatory staff perform acceptance testing. |
| Test data | What kinds of data must be prepared? | Normal bookings, invalid formats and values around each permitted limit. |
| Entry criteria | What must be ready before a test stage begins? | The booking build is installed and the test database has known capacity. |
| Exit criteria | What conditions indicate that the stage can finish? | Mandatory tests pass and no unresolved critical-capacity fault remains. |
| Retesting | How will corrections and existing features be checked? | Repeat the failed case and related booking-capacity regression tests. |
| Evidence | What records will be retained? | Test results, fault references, browser details and retest outcomes. |
Strategy Example: Community Observatory Portal
A community observatory is developing a portal for reserving guided telescope sessions. Each session has limited capacity and lasts for a permitted duration.
Selected rules
| Requirement | Rule |
|---|---|
| R1 | Group size must be a whole number from 2 to 12 inclusive. |
| R2 | Session duration must be from 30 to 180 minutes inclusive and must be a multiple of 15. |
| R3 | A booking reference must contain exactly eight uppercase letters or digits. |
| R4 | A booking must not be created when the requested group is larger than the remaining capacity. |
| R5 | Cancelling a future booking must return its places to the session. |
Condensed strategy
| Area | Decision |
|---|---|
| Highest risks | Overbooking, duplicate references and places not being restored after cancellation |
| Early testing | Test validation and reference-generation modules separately. |
| Integration testing | Connect validation, capacity, storage and confirmation modules gradually. |
| Black-box testing | Derive complete booking tests from R1βR5. |
| Environments | Supported mobile and desktop browsers using a resettable test database. |
| Release checks | Internal alpha testing followed by observatory staff acceptance testing. |
| Completion condition | All mandatory tests pass and no unresolved fault can create an invalid booking. |
Test Plans
The strategy gives the overall direction. The test plan contains the concrete tests needed to implement that strategy.
| Test strategy | Test plan | Test case |
|---|---|---|
| Overall approach for the project | Organised collection of detailed tests | One specified test |
| Describes scope, methods, stages and responsibilities | Lists features, environments and cases | Contains exact data, steps and expected behaviour |
| Changes relatively infrequently | Updated as requirements and builds change | Executed and recorded individually |
Likely Contents of a Test Case
| Field | Purpose | Example |
|---|---|---|
| Test ID | Provides a unique reference. | OBS-GRP-04 |
| Requirement reference | Shows why the test exists. | R1 |
| Feature or component | Identifies the area under test. | Group-size validation |
| Purpose | States the particular behaviour being checked. | Check the upper accepted group size. |
| Preconditions | Defines the required starting state. | A session with at least 12 remaining places |
| Test data | Gives exact values. | GroupSize = 12 |
| Test steps | Explains the actions to perform. | Enter 12 and submit the booking form. |
| Expected result | States the required observable behaviour. | The value is accepted and the booking can continue. |
| Actual result | Records what happened during execution. | Completed by the tester |
| Outcome | Compares actual with expected. | Pass or fail |
| Environment and version | Supports repetition of the test. | Build 0.8.4, mobile browser |
| Fault reference | Links a failure to its recorded defect. | DEF-027 |
| Retest result | Records the result after correction. | Passed in build 0.8.5 |
Fields completed at different times
| Before execution | During or after execution |
|---|---|
| Test ID | Actual result |
| Requirement and purpose | Pass or fail |
| Preconditions and test data | Fault reference |
| Steps and expected result | Retest result |
Connecting Requirements to Tests
A requirements-coverage table helps the team check that each important requirement has at least one relevant test.
| Requirement | Tests | Coverage purpose |
|---|---|---|
| R1: group size 2β12 |
OBS-GRP-01 to OBS-GRP-07
|
Typical values, limits, adjacent invalid values and invalid types |
| R2: duration 30β180, multiple of 15 |
OBS-DUR-01 to OBS-DUR-08
|
Range limits, step rule and invalid type |
| R3: eight-character reference |
OBS-REF-01 to OBS-REF-06
|
Length, permitted characters and case |
| R4: capacity cannot be exceeded |
OBS-CAP-01 to OBS-CAP-04
|
Enough capacity, exact capacity and insufficient capacity |
| R5: cancellation restores places |
OBS-CAN-01 to OBS-CAN-03
|
Valid cancellation, repeated cancellation and expired booking |
Test Data
Test values should be chosen because they check a stated rule. Random values may be useful for additional exploration, but they do not replace purposeful test design.
| Category | Main idea | Group-size example |
|---|---|---|
| Normal | A typical valid value that should be accepted | 6 |
| Abnormal | An invalid value or form of data that should be rejected | "six" or 6.5 |
| Extreme | A lowest or highest valid value | 2 and 12 |
| Boundary | Values at and immediately around a limit | 1, 2, 3, 11, 12, 13 |
1 is
invalid and is also useful as a just-outside boundary test. State the purpose for
which the value was selected.
Normal Test Data
Normal data demonstrates that ordinary use works. It should not always be placed extremely close to a limit.
| Rule | Normal value | Expected result |
|---|---|---|
| Group size 2β12 | 6 |
Accepted |
| Duration 30β180 in multiples of 15 | 90 |
Accepted |
| Eight uppercase letters or digits | SKY7A2Q9 |
Accepted |
Abnormal Test Data
Different abnormal values should target different reasons for rejection.
| Rule being checked | Abnormal data | Reason for rejection |
|---|---|---|
| Group size must be an integer. | 6.5 |
Not a whole number |
| Group size must be numeric. | "six" |
Wrong data type or format |
| Duration must be a multiple of 15. | 50 |
Inside the range but violates the step rule |
| Reference contains uppercase letters or digits. | SKY#A2Q9 |
Contains a prohibited symbol |
| Reference must use uppercase characters. | sky7a2q9 |
Uses lowercase letters |
Extreme and Boundary Test Data
Boundary data: values at and immediately around the points where program behaviour should change.
Integer range
For a group size from 2 to 12 inclusive:
| Value | Position | Expected result |
|---|---|---|
1 |
Immediately below the minimum | Rejected |
2 |
Minimum extreme value | Accepted |
3 |
Immediately inside the lower range | Accepted |
11 |
Immediately inside the upper range | Accepted |
12 |
Maximum extreme value | Accepted |
13 |
Immediately above the maximum | Rejected |
Length rule
When a reference must contain exactly eight characters, the useful lengths are:
| Length | Purpose | Expected result |
|---|---|---|
| 7 characters | Immediately below the required length | Rejected |
| 8 characters | Exact accepted boundary | Accepted when all characters are permitted |
| 9 characters | Immediately above the required length | Rejected |
Choosing βjust outsideβ for real numbers
The smallest useful difference depends on the precision allowed by the requirement. If a temperature is stored to one decimal place and the maximum is 25.0, a value of 25.1 is immediately outside. A value such as 25.0001 would be unsuitable when the system accepts only one decimal place.
Choosing High-quality Test Data
Start with the complete rule
A field may have several independent requirements:
GroupSize must be numeric, an integer and from 2 to 12 inclusive.
A suitable data set checks each part:
| Value | Purpose | Expected result |
|---|---|---|
6 |
Typical valid value | Accepted |
2 |
Minimum accepted value | Accepted |
1 |
Immediately below the minimum | Rejected |
12 |
Maximum accepted value | Accepted |
13 |
Immediately above the maximum | Rejected |
6.5 |
Invalid integer requirement | Rejected |
"six" |
Invalid numeric requirement | Rejected |
Prefer one clear purpose per test
Suppose a reference must contain exactly eight uppercase letters or digits.
The value ab#1 is too short, lowercase and contains a prohibited symbol.
Its rejection does not reveal which validation rule was applied.
Clearer separate tests include:
SKY7A2Qβ seven permitted characters;sky7a2q9β correct length but lowercase;SKY#A2Q9β correct length but contains a symbol.
Worked Example: Observatory Booking Test Plan
Validation test cases
| ID | Req. | Purpose | Test data | Category | Expected result |
|---|---|---|---|---|---|
| OBS-GRP-01 | R1 | Check a typical valid group | GroupSize = 6 |
Normal | Accepted |
| OBS-GRP-02 | R1 | Check the minimum group | GroupSize = 2 |
Extreme/boundary | Accepted |
| OBS-GRP-03 | R1 | Check immediately below the minimum | GroupSize = 1 |
Boundary, invalid | Rejected with a group-size message |
| OBS-GRP-04 | R1 | Check the maximum group | GroupSize = 12 |
Extreme/boundary | Accepted |
| OBS-GRP-05 | R1 | Check immediately above the maximum | GroupSize = 13 |
Boundary, invalid | Rejected with a group-size message |
| OBS-GRP-06 | R1 | Check integer validation | GroupSize = 6.5 |
Abnormal | Rejected because a whole number is required |
| OBS-DUR-01 | R2 | Check a typical permitted duration | Duration = 90 |
Normal | Accepted |
| OBS-DUR-02 | R2 | Check the lower duration limit | Duration = 30 |
Extreme/boundary | Accepted |
| OBS-DUR-03 | R2 | Check the step requirement | Duration = 50 |
Abnormal | Rejected because duration must be a multiple of 15 |
| OBS-REF-01 | R3 | Check a valid reference | SKY7A2Q9 |
Normal | Accepted |
| OBS-REF-02 | R3 | Check a reference one character too short | SKY7A2Q |
Boundary, invalid | Rejected because eight characters are required |
| OBS-REF-03 | R3 | Check permitted characters | SKY#A2Q9 |
Abnormal | Rejected because # is not permitted |
Functional test cases
| ID | Req. | Precondition | Action | Expected result |
|---|---|---|---|---|
| OBS-CAP-01 | R4 | Six places remain. | Request four places. | Booking created and remaining capacity becomes two. |
| OBS-CAP-02 | R4 | Four places remain. | Request four places. | Booking created and remaining capacity becomes zero. |
| OBS-CAP-03 | R4 | Four places remain. | Request five places. | Request rejected, no booking created and capacity remains four. |
| OBS-CAN-01 | R5 | A future booking for three visitors exists; two other places remain. | Cancel the booking. | Status becomes cancelled and remaining capacity becomes five. |
| OBS-CAN-02 | R5 | The same booking is already cancelled. | Submit cancellation again. | Request rejected and capacity remains unchanged. |
Executing, Recording and Retesting
When the test is run, the tester records the actual result and compares it with the result written in advance.
| ID | Expected result | Actual result | Outcome | Follow-up |
|---|---|---|---|---|
| OBS-GRP-04 | Group size 12 is accepted. | Group size 12 was accepted. | Pass | None |
| OBS-CAP-03 | Request rejected and capacity remains four. | Booking created and capacity became β1. | Fail | Record DEF-031. |
| OBS-CAN-01 | Cancellation restores three places. | Booking was cancelled but capacity remained two. | Fail | Record DEF-032. |
After a correction
- Repeat the test that originally failed.
- Confirm that the expected and actual results now agree.
- Repeat related tests that may have been affected.
- Record the new build or version.
- Update the fault and test records.
| Fault | Direct retest | Related regression tests |
|---|---|---|
| Capacity can become negative | OBS-CAP-03 |
OBS-CAP-01 and OBS-CAP-02
|
| Cancellation does not restore places | OBS-CAN-01 |
OBS-CAN-02 and capacity tests
|
Interactive: Strategy and Test-data Planner
Choose a validation rule, explore purposeful data values and add selected cases to a growing test plan. The widget explains the category, reason and expected result for each value.
Common Mistakes and Misconceptions
- Confusing the strategy with the plan. The strategy is high-level; the plan contains detailed repeatable tests.
- Writing βtest the system thoroughly.β State which features, risks, methods and environments will be used.
- Giving data without a purpose. Explain which rule each value checks.
- Omitting the expected result. A test cannot be judged consistently without a predicted outcome.
- Using only normal values. Invalid data and limits may expose different faults.
- Calling every invalid value abnormal and ignoring its boundary purpose. A just-outside value may be both invalid and a boundary test.
- Testing only the exact limits. Include appropriate values immediately inside and outside them.
- Choosing the wrong adjacent value. Consider whether the field uses integers, characters or a stated decimal precision.
- Combining several invalid reasons in one test. Separate tests make the cause of rejection clearer.
- Ignoring preconditions. Functional tests such as capacity checks need a known starting state.
- Changing the expected result after a failure. The expectation should remain based on the agreed requirement.
- Recording only pass or fail. Record the actual behaviour and a fault reference when the test fails.
Practice
Core questions
- Explain why a test strategy is required.
- State six likely contents of a test strategy.
- Distinguish between a test strategy and a test plan.
- State six likely fields in a detailed test case.
- Explain why expected results are recorded before execution.
- Define normal test data.
- Define abnormal test data.
- Distinguish extreme data from a broader set of boundary data.
- Explain why requirements should be linked to test cases.
- Explain what should be recorded after a test fails.
Scenario A: Planetarium Audio-guide Hire
The number of audio guides must be a whole number from 1 to 20 inclusive.
- Give two normal values.
- Give the minimum and maximum extreme values.
- Give values immediately inside and outside both limits.
- Give two abnormal values that test different invalid reasons.
- State the expected result for every value.
- Write two complete test-plan rows.
Scenario B: Archive Identifier
An archive identifier must contain exactly ten characters. The first two must be uppercase letters and the remaining eight must be digits.
- Give one normal identifier.
- Give boundary tests for the complete length.
- Give one test for lowercase letters.
- Give one test for a letter in the numeric section.
- Explain why one short lowercase identifier would be a weak test.
- Create a requirement-coverage table for the format rules.
Scenario C: Community Laboratory Session
A session can accept at most 18 participants. A booking may request 1 to 6 places, but it must also fit within the remaining capacity.
- Write a short test strategy covering the highest risks and suitable methods.
- Write tests for request-size validation.
- Write tests for exact remaining capacity.
- Write a test in which the requested places exceed the capacity by one.
- State the required precondition for each capacity test.
- Explain which tests should be repeated after correcting an overbooking fault.
Review
| Prompt | A strong response should include |
|---|---|
| Test strategy | Overall scope, priorities, methods, stages, environments, responsibilities and completion conditions |
| Test plan | An organised collection of detailed, repeatable test cases |
| Test case | ID, purpose, preconditions, exact data, steps, expected result, actual result and outcome |
| Normal data | A representative valid value that should be accepted |
| Abnormal data | Invalid data selected to check rejection or safe handling |
| Extreme data | The minimum or maximum valid value |
| Boundary data | Values at and immediately around a change in expected behaviour |
| Requirement coverage | Evidence that important requirements are connected to suitable tests |
| Failed test | Expected result, actual result, environment, fault reference and planned retest |