Writing a test plan from requirements

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Writing a test plan from requirements

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which describes a test plan?
A A list of test cases for each requirement, with expected results, written before testing starts
B A list of bugs you found after running the program, written once testing is finished
2. Requirement: 'The program accepts ages from 13 to 18.' Which test case should a test plan include for this requirement?
A Test 13 and 18 as boundary values, with the expected result 'accepted'
B Test only the age 15 because it is in the middle of the range
3. What should every row in a test plan be linked to?
A A requirement that the test is checking
B The line number where the code was written
4. Requirement: 'Reject a password shorter than 8 characters.' Which is an invalid test case?
A A password with 10 characters, expected result: accepted
B A password with 5 characters, expected result: rejected
5. When should you write the expected result for a test in a test plan?
A After running the program, by copying what it displays
B Before running the program

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1Requirement R1: Age must be 13 to 18 Test 1: age = 15, expected: accepted AR2 | score = 50 | normal | accepted R2 | score = 100 | boundary | accepted R2 | score = -5 | invalid | rejected
2R1 | 13 | boundary | accepted R1 | 12 | boundary | rejected BThe test case has no expected result, so there is nothing to compare the actual result with. Every test in a plan needs an expected result.
3A good test plan covers each requirement with a normal, a boundary and an invalid test case CA normal test case linked to requirement R1, with its expected result written in the plan before testing
4A test plan is written before testing, so the expected result is decided before the code is run DThe test is not linked to a requirement, so nobody can tell which requirement it checks or whether all requirements are covered.
5R3 | name = 'Sam' | normal | (no expected result) ETwo boundary test cases for requirement R1, just inside and just outside the limit, each with an expected result
6Test 4 | age = 20 | normal | accepted FExpected: 'Pass' (written in the plan) Actual: ______ (filled in after running)

Definitions

test plan

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
# R1: age must be 13 to 18 test = ("__", "normal", 15, "accept")
2.
# R1: age must be 13 to 18 test = ("R1", "________", 18, "accept")
3.
# R1: age must be 13 to 18 test = ("R1", "_______", "abc", "reject")
4.
# Plan results before testing starts header = ("req", "type", "input", "________")
5.
# R3: password needs 8 or more characters test = ("R3", "boundary", "a" * _, "accept")

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A plan_done = False
B if plan_done:
C print("Start testing")
Question 2
A # R1: score 0 to 100
B normal = 50
C boundary = 100
D invalid = 100
Question 3
A plan = [
B "R1,normal,50,accept",
C "R1,boundary,0,accept",
D "R1,invalid,-1,accept",
E ]
Question 4
A reqs = 2
B kinds = 3
C total = reqs + kinds
D print(total)
Question 5
A req = "Password 8+ chars"
B normal = "sunshine99"
C boundary = "abcdefg"
D invalid = "abc"

Answer Key

Writing a test plan from requirements
Section A: Quick Questions
Q1
A — A list of test cases for each requirement, with expected results, written before testing starts
Q2
A — Test 13 and 18 as boundary values, with the expected result 'accepted'
Q3
A — A requirement that the test is checking
Q4
B — A password with 5 characters, expected result: rejected
Q5
B — Before running the program
Section B: Match the Pairs
Q1
Requirement R1: Age must be 13 to 18 Test 1: age = 15, expected: accepted → A normal test case linked to requirement R1, with its expected result written in the plan before testing
Q2
R1 | 13 | boundary | accepted R1 | 12 | boundary | rejected → Two boundary test cases for requirement R1, just inside and just outside the limit, each with an expected result
Q3
A good test plan covers each requirement with a normal, a boundary and an invalid test case → R2 | score = 50 | normal | accepted R2 | score = 100 | boundary | accepted R2 | score = -5 | invalid | rejected
Q4
A test plan is written before testing, so the expected result is decided before the code is run → Expected: 'Pass' (written in the plan) Actual: ______ (filled in after running)
Q5
R3 | name = 'Sam' | normal | (no expected result) → The test case has no expected result, so there is nothing to compare the actual result with. Every test in a plan needs an expected result.
Q6
Test 4 | age = 20 | normal | accepted → The test is not linked to a requirement, so nobody can tell which requirement it checks or whether all requirements are covered.
Section C: Definitions
Q1
test plan — A list, made before testing, of normal, boundary and invalid test cases for each requirement, with the expected result for every test.
Section D: Fill in the Blanks
Q1
# R1: age must be 13 to 18 test = ("R1", "normal", 15, "accept")
Q2
# R1: age must be 13 to 18 test = ("R1", "boundary", 18, "accept")
Q3
# R1: age must be 13 to 18 test = ("R1", "invalid", "abc", "reject")
Q4
# Plan results before testing starts header = ("req", "type", "input", "expected")
Q5
# R3: password needs 8 or more characters test = ("R3", "boundary", "a" * 8, "accept")
Section E: Spot the Error
Q1
A — A test plan must be finished before testing starts. The flag should be True so that testing only begins once the plan exists.
Q2
D — 100 is inside the allowed range (it is a boundary value), so it is not invalid. An invalid test for R1 must be outside the range, such as 101.
Q3
D — The expected result for an invalid test must be reject. -1 is outside the 0 to 100 range, so the plan should say reject, not accept.
Q4
C — Each requirement needs a normal, boundary and invalid test, so the total number of tests is requirements multiplied by kinds (2 * 3 = 6), not added.
Q5
C — The boundary for 'at least 8 characters' is exactly 8 characters. 'abcdefg' has only 7, so it is an invalid test. The boundary should be 'abcdefgh'.