Easier to read with cream paper, a tint, more contrast or larger text? Choose your colours and text, once, for every page.

Preview

AC 2.9: Writing and using a test plan

This is the first page of the lesson. Read it and have a go at the activities. The rest is in the full lesson.

60 minutes

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

WordWhat it means
Test plana table of the tests to run, what each one checks and what should happen
Purposewhat a single test is trying to find out
Test datathe values used in a test
Expected resultwhat should happen, written before the test is run
Actual resultwhat really happened when the test was run
Passthe actual result matches the expected result
Failthe 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 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Your answers are marked here and are not kept. A college account keeps every student’s marks.

Five steps of a test plan

  1. Identify the tests to carry out.
  2. Describe the purpose of each test.
  3. Identify the test data to use.
  4. Describe the expected result before you run anything.
  5. 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

NoPurposeTest dataExpectedActualResult
1Normal year is accepted10AcceptedAcceptedPass
2Lowest allowed year is accepted7AcceptedAcceptedPass
3Year just below range is refused6RejectedAcceptedFail
4A word is refusedtenRejectedRejectedPass

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

Code: python
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 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Your answers are marked here and are not kept. A college account keeps every student’s marks.

The lesson goes on

5 more parts of this lesson are in the full curriculum, with the tasks, the final check and the labs. A college account gives your students all of it.