Test table layout

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

Test table layout

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. A test table has one row for each what?
A Test case
B Line of code
2. Which set of columns belongs in a test table?
A Test number, purpose, input, expected result, actual result, pass/fail
B Variable name, data type, loop count, line number, author
3. Which column says WHY you are running the test, such as 'check the lowest allowed mark'?
A Purpose
B Actual result
4. Where do you write the answer you predicted BEFORE running the program?
A Actual result column
B Expected result column
5. A tester runs a program and sees it print 12. Which column do they write 12 in?
A Expected result
B Actual result

Match the Pairs

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

Left columnRight column
1Test | Purpose | Input | Expected | Actual | Pass/Fail ATwo tests are squeezed into one row. A test table needs one row per test, so this should be split into two rows (test 1 with input 50 and test 2 with input 100).
22 | Boundary | 100 | Accepted | Accepted | Pass BInput: 18 | Expected: Accepted
3The input and expected result columns hold what you plan to test, decided before running the program COne complete row of a test table, which records a single test case from number to verdict.
4The actual result and pass/fail columns record what really happened when the test was run DThe actual result column is blank but a Pass is recorded. You must run the test and write the actual result before deciding pass or fail.
51 | Normal and boundary | 50, 100 | Accepted | Accepted | Pass EThe column headings of a test table: one column for each part of a test case.
63 | Abnormal | -5 | Rejected | | Pass FActual: Rejected | Result: Fail

Definitions

test table

Fill in the Blanks

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

1.
row = {"test": 1, "_______": "Normal mark"}
2.
row = {"input": 85, "________": "Pass"}
3.
row = {"expected": 5, "______": 5}
4.
if actual __ expected: print("PASS")
5.
tests = [(1, 50), (2, 0), (3, 100)] rows = ___(tests) print(rows)

Spot the Error

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

Question 1
A test_no = 1
B purpose = Normal value
C test_input = 5
D expected = 10
E actual = 10
Question 2
A tests = [
B (1, "Normal", 5, 10),
C (2, "Boundary", 0, 0),
D (3, "Abnormal", -1),
E ]
Question 3
A ps = ["Normal", "Edge"]
B for n, p in enumerate(ps):
C print(n, p)
Question 4
A expected = 10
B actual = 10
C if actual != expected:
D result = "PASS"
E else:
F result = "FAIL"
Question 5
A table = []
B table.append((1, "Normal", 5))
C table.append((2, "Edge", 0))
D table.append((2, "Bad", -1))
E print(len(table))

Answer Key

Test table layout
Section A: Quick Questions
Q1
A — Test case
Q2
A — Test number, purpose, input, expected result, actual result, pass/fail
Q3
A — Purpose
Q4
B — Expected result column
Q5
B — Actual result
Section B: Match the Pairs
Q1
Test | Purpose | Input | Expected | Actual | Pass/Fail → The column headings of a test table: one column for each part of a test case.
Q2
2 | Boundary | 100 | Accepted | Accepted | Pass → One complete row of a test table, which records a single test case from number to verdict.
Q3
The input and expected result columns hold what you plan to test, decided before running the program → Input: 18 | Expected: Accepted
Q4
The actual result and pass/fail columns record what really happened when the test was run → Actual: Rejected | Result: Fail
Q5
1 | Normal and boundary | 50, 100 | Accepted | Accepted | Pass → Two tests are squeezed into one row. A test table needs one row per test, so this should be split into two rows (test 1 with input 50 and test 2 with input 100).
Q6
3 | Abnormal | -5 | Rejected | | Pass → The actual result column is blank but a Pass is recorded. You must run the test and write the actual result before deciding pass or fail.
Section C: Definitions
Q1
test table — A table with one row per test case. Its columns are test number, purpose, input, expected result, actual result and pass or fail.
Section D: Fill in the Blanks
Q1
row = {"test": 1, "purpose": "Normal mark"}
Q2
row = {"input": 85, "expected": "Pass"}
Q3
row = {"expected": 5, "actual": 5}
Q4
if actual == expected: print("PASS")
Q5
tests = [(1, 50), (2, 0), (3, 100)] rows = len(tests) print(rows)
Section E: Spot the Error
Q1
B — The purpose column holds a text description, so it must be a string in quotes: purpose = "Normal value". Without quotes Python reads it as code and fails.
Q2
D — Every row needs the same columns. This row has no expected result, so it doesn't line up with the others. It should be (3, "Abnormal", -1, "Err").
Q3
B — enumerate starts counting at 0 by default. Test numbers in a test table start at 1, so the line should be enumerate(ps, 1).
Q4
C — A test passes when the actual result matches the expected result. Using != marks matching results as PASS and different ones as FAIL. It should be ==.
Q5
D — Each test gets its own row with its own test number. Number 2 is used twice, so the third test is not numbered 3. The row should start with 3.