Recording corrections in a testing table

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

Recording corrections in a testing table

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. A test case fails. What should the testing table record next?
A The corrective action taken to fix the problem
B Nothing, until all tests have been run
2. Which column shows whether a fix actually worked?
A Expected output
B Retest result
3. Test 4 failed because age 0 was accepted. Which is a good corrective action entry?
A Fixed the bug
B Changed the check to age >= 1 in validate_age()
4. After applying a fix, the test is run again and gives the expected output. What is the retest result?
A Pass
B Fail
5. The retest of a fixed test still gives the wrong output. What should happen?
A Record Fail, then make and record another corrective action
B Change the expected output to match the actual output

Match the Pairs

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

Left columnRight column
1Test 3 | Expected: 50 | Actual: 5 | Result: Fail ACorrection: added int() around input() to convert age to a number
2Correction: changed < to <= in the loop condition | Retest: Pass BRetest result: Fail - still returns 5, so try a new fix
3The corrective action column records exactly what was changed in the code to fix a failed test CA corrective action and retest result: the fix made, then proof from running the test again that it now works
4After a fix, the same test is run again and the retest result is recorded as Pass or Fail DA failed test row: the actual output does not match the expected output, so a correction is needed
5Test 4 | Result: Fail | Correction: (blank) | Retest: Pass EThe correction is vague and there is no retest result, so nobody knows if the fix worked
6Test 2 | Result: Fail | Correction: fixed the code | Retest: (blank) FThe test failed but no corrective action is recorded, so the retest Pass cannot be traced to any fix

Definitions

corrective action

Fill in the Blanks

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

1.
if actual __ expected: row["result"] = "Fail"
2.
row = tests[3] row["___"] = "Added int() conversion"
3.
actual = add(2, 3) row["retest"] = actual __ expected
4.
__ row["result"] == "Fail": row["fix"] = "Fixed loop range"
5.
for row in tests: if row["______"] == "Fail": print(row["id"], "still fails")

Spot the Error

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

Question 1
A result = "fail"
B if result = "fail":
C fix = "Changed < to <="
D print(fix)
Question 2
A outcome = "fail"
B if outcome == "fail":
C fix = "Added int()
D retest = "pass"
Question 3
A expected = 10
B actual = 4 + 6
C if actual != expected:
D retest = "pass"
Question 4
A row = {"test": 5}
B row["fix"] == "Added a check"
C row["retest"] = "pass"
D print(row)
Question 5
A table = []
B row = ["T5", "Fix", "pass"]
C table.add(row)
D print(table[0])

Answer Key

Recording corrections in a testing table
Section A: Quick Questions
Q1
A — The corrective action taken to fix the problem
Q2
B — Retest result
Q3
B — Changed the check to age >= 1 in validate_age()
Q4
A — Pass
Q5
A — Record Fail, then make and record another corrective action
Section B: Match the Pairs
Q1
Test 3 | Expected: 50 | Actual: 5 | Result: Fail → A failed test row: the actual output does not match the expected output, so a correction is needed
Q2
Correction: changed < to <= in the loop condition | Retest: Pass → A corrective action and retest result: the fix made, then proof from running the test again that it now works
Q3
The corrective action column records exactly what was changed in the code to fix a failed test → Correction: added int() around input() to convert age to a number
Q4
After a fix, the same test is run again and the retest result is recorded as Pass or Fail → Retest result: Fail - still returns 5, so try a new fix
Q5
Test 4 | Result: Fail | Correction: (blank) | Retest: Pass → The test failed but no corrective action is recorded, so the retest Pass cannot be traced to any fix
Q6
Test 2 | Result: Fail | Correction: fixed the code | Retest: (blank) → The correction is vague and there is no retest result, so nobody knows if the fix worked
Section C: Definitions
Q1
corrective action — The fix recorded in a testing table for a failed test, followed by the retest result that shows whether the fix worked (pass or fail).
Section D: Fill in the Blanks
Q1
if actual != expected: row["result"] = "Fail"
Q2
row = tests[3] row["fix"] = "Added int() conversion"
Q3
actual = add(2, 3) row["retest"] = actual == expected
Q4
if row["result"] == "Fail": row["fix"] = "Fixed loop range"
Q5
for row in tests: if row["retest"] == "Fail": print(row["id"], "still fails")
Section E: Spot the Error
Q1
B — A single = assigns a value, so it cannot be used to test whether the result was a fail. The check that decides if a corrective action is recorded needs the comparison operator ==.
Q2
C — The string for the corrective action is missing its closing quote, so Python raises a SyntaxError. It should be fix = "Added int()".
Q3
C — The retest should be marked pass only when the actual output matches the expected output. != marks it as pass when they differ. It should be ==.
Q4
B — == compares values and does not store anything. The fix is never added to the record, and the comparison raises a KeyError. Use = to assign the corrective action to the "fix" field.
Q5
C — Lists have no add() method, so this raises an AttributeError. A row is added to the testing table list with table.append(row).