Proof that you tested it
A manager asks: "Did you test the survey cleaner?" You say yes. "What did you try? What happened?" You cannot remember.
A test plan is a table you fill in as you go. It answers those questions and lets someone else repeat your tests.
Key words
| Word | What it means |
|---|---|
| Test plan | a table of the tests to run, what each one checks and what should happen |
| Purpose | what a single test is trying to find out |
| Test data | the values used in a test |
| Expected result | what should happen, written before the test is run |
| Actual result | what really happened when the test was run |
| Pass | the actual result matches the expected result |
| Fail | the actual result is different from the expected result |
The cells students fill in are left blank in this preview.
By the end of this lesson
Note
I can set out the steps and structure of a test plan, fill one in, and use it to record results.
Starter
Have a go
Starter
3 questionsYour answers are marked here and are not kept. A college account keeps every student’s marks.
Five steps of a test plan
- Identify the tests to carry out.
- Describe the purpose of each test.
- Identify the test data to use.
- Describe the expected result before you run anything.
- Record the actual result, then mark pass or fail.
Steps 1 to 4 are written before testing. Step 5 is filled in during it.
A test plan as a table
| No | Purpose | Test data | Expected | Actual | Result |
|---|---|---|---|---|---|
| 1 | Normal year is accepted | 10 | Accepted | Accepted | Pass |
| 2 | Lowest allowed year is accepted | 7 | Accepted | Accepted | Pass |
| 3 | Year just below range is refused | 6 | Rejected | Accepted | Fail |
| 4 | A word is refused | ten | Rejected | Rejected | Pass |
The cells students fill in are left blank in this preview.
What a plan is used for
A plan is used when you test a new solution, when you re-test after a change, and when you show others what was checked.
Test 3 failed. The solution accepted year 6. The plan shows exactly which test, with which data, so the fault is easy to fix and test 3 is run again.
Try it: a plan filled in by code
def year_ok(year):
return year >= 7
plan = [["normal year", 10, True], ["below the lowest", 6, False], ["above the highest", 14, False]]
for test in plan:
actual = year_ok(test[1])
result = "pass" if actual == test[2] else "fail"
print(test[0], "expected", test[2], "actual", actual, result)
# This check has no upper limit. Which test fails? Fix year_ok.
Check
Have a go
Check
3 questionsYour answers are marked here and are not kept. A college account keeps every student’s marks.