SLIDE 1
CSZone.co.uk
Click to advance · Arrow keys also work
CAIE 9618 · Paper 2 · Topic 2.5.1

Testing
Strategies

Black Box · White Box · Test Data Types · Test Tables · Trace Tables

CSZone Cambridge International AS & A Level Computer Science 9618
Why Test Software?

Finding Errors Before Users Do

Testing is the systematic process of running a program with planned inputs to verify it produces the correct outputs and handles all cases properly. The goal is to find and fix bugs before deployment.
TYPES OF ERROR
Syntax error — invalid code structure (caught at compile/parse time).
Runtime error — crash during execution (e.g. division by zero).
Logic error — program runs but produces wrong output.
TESTING APPROACHES
Black box — test without knowledge of internal code. Focus on inputs and expected outputs.
White box — test with knowledge of code. Ensure all paths/branches are covered.
Test Data Categories

Normal, Boundary, Erroneous & Extreme

For a function that accepts an age 0–120:
TypeDefinitionExample (age 0–120)Expected Result
Normal (valid)Typical, expected input within range25, 67, 5Accepted, processed normally
BoundaryExact at the edge of valid range0, 120Accepted (boundary included)
ExtremeValid but at extreme ends of range1, 119Accepted and processed
Erroneous (invalid)Outside valid range, wrong type, no input-1, 121, "abc", emptyRejected with error message
Key: Always test both sides of each boundary — just inside valid range AND just outside.
Test Tables

Documenting Tests Systematically

Test program accepting age 0–120 and outputting "Valid" or "Invalid":
Test #TypeInputExpected OutputActual OutputPass/Fail
1Normal45"Valid""Valid"✓ Pass
2Boundary0"Valid""Valid"✓ Pass
3Boundary120"Valid""Valid"✓ Pass
4Erroneous-1"Invalid""Invalid"✓ Pass
5Erroneous121"Invalid""Valid"✗ Fail
6Erroneous"abc"Error messageCrash✗ Fail
Exam Practice

Cambridge-style questions

Question 1
A program accepts a score from 1 to 100. State one example of each of the following test data types and explain why you chose it: (i) boundary data, (ii) erroneous data.
4 marks
2 marks
(i) Boundary data: 1 or 100 — because these are at the exact limits of the valid range; testing boundary values checks that the comparison operators use <= and >= correctly rather than < and >.
2 marks
(ii) Erroneous data: 0 or 101 or "hello" — because these are outside the valid range or of the wrong type; testing erroneous data confirms the program correctly rejects invalid inputs and displays an appropriate error message rather than processing them.
Common Mistakes

Don't lose easy marks

1
Giving only one boundary value — for a range 1–100, both 1 AND 100 are boundary values. Also consider 0 and 101 (just outside boundary). The mark scheme often expects candidates to identify the boundaries on both sides.
2
Confusing black box and white box testing — black box: tester doesn't see the code, tests from external specification (what the program should do). White box: tester sees the code, ensures all branches/paths are executed. A common mark-scheme requirement is to explain what the tester does or doesn't know.
3
Leaving the Actual Output column blank — in a test table question, the exam often presents a partly-filled table and asks you to complete it. If actual output is the same as expected, write it in — don't leave it blank. A blank actual output loses a mark.
Topic Summary — 2.5.1

What You Need to Know

TESTING TYPES
Black box: input/output, no code knowledge
White box: code coverage, all paths tested
Unit: individual modules · Integration: combined
ERROR TYPES
Syntax: invalid code structure
Runtime: crash during execution
Logic: wrong output, program runs
TEST DATA TYPES
Normal: typical valid input
Boundary: exact edge of valid range
Extreme: valid but at limits
Erroneous: outside range / wrong type
Test table: input, expected, actual, pass/fail
CSZone

Next Video

2.5.2
Program Design Methodologies
Waterfall · Agile · RAD · Software Life Cycle
Head to CSZone.co.uk for the complete worksheet, quiz, and interactive tools