🔒
Unlock Everything
£7.99/month
or £59/year
Subscribe now →
🛡️ Component 2 · 2.3 Producing Robust Programs
2.3.2 Testing
OCR J277 · GCSE Computer Science · ~12 min read
Notes
Video
Slides
Worksheet
Quiz

Why Testing?

Testing is used to find and fix errors (bugs) in a program before it is released. A well-tested program produces correct output for all inputs, including unexpected ones. No testing = undetected bugs = unreliable software.

Types of Testing

TypeDefinitionWho does it?
Iterative testingTesting carried out during development — testing each module/component as it is writtenDeveloper
Final (terminal) testingTesting carried out at the end of development once the complete program is builtDeveloper / Client
Alpha testingIn-house testing by the development team / company before public releaseDeveloper team
Beta testingTesting by a limited group of real users (outside the company) before public releaseReal users (testers)

Test Data Types

When writing a test plan, OCR J277 expects you to use three categories of test data:

CategoryDescriptionExample (age, 0–120)
NormalValid data the program should accept and process correctly25, 50, 100
BoundaryData at the very edge of the valid range (just inside, on, and just outside)0, 1, 119, 120, -1, 121
ErroneousInvalid data that should be rejected — wrong type, completely out of range-10, 200, "abc", ""

Test Data Table — Worked Example

Program: accepts an age between 0 and 120 (inclusive).

TestCategoryInputExpected OutputActual OutputPass/Fail
1Normal25"Age accepted""Age accepted"✅ Pass
2Normal75"Age accepted""Age accepted"✅ Pass
3Boundary0"Age accepted""Age accepted"✅ Pass
4Boundary120"Age accepted""Age accepted"✅ Pass
5Boundary-1Error messageError message✅ Pass
6Boundary121Error messageError message✅ Pass
7Erroneous"hello"Error messageError message✅ Pass
8Erroneous500Error messageError message✅ Pass

Types of Errors

Error TypeDescriptionExample
Syntax errorCode breaks the rules of the programming language — program cannot runPINT "Hello" (missing 'R' in PRINT)
Logic errorProgram runs but produces incorrect output — algorithm is wrongUsing + instead of - in a formula
Runtime errorError that occurs while the program is running — causes a crashDivision by zero; index out of bounds

Iterative vs Final Testing

  • Iterative: test as you build — catch bugs early when they're cheap to fix; each module tested before the next is written
  • Final: whole program tested together — checks integration of all parts; more complex bugs found here
  • Both are used in practice — iterative during development, final before release
Exam tip: OCR J277 tests you on: (1) the three test data types — always give an example for each when asked; (2) the difference between iterative and final testing; (3) completing a test table (fill in expected output or category); (4) identifying error types from code/description. Boundary data is the most commonly missed — it includes values just inside, exactly on, AND just outside the boundary.
⚠️ Common Mistakes
  • Forgetting that boundary data includes BOTH the valid boundary (accept) AND just outside (reject)
  • Calling all wrong inputs "erroneous" — wrong TYPE is erroneous; wrong VALUE at the edge is boundary
  • Confusing syntax errors (won't run) with logic errors (runs but wrong output)
  • Only testing with normal data — boundary and erroneous tests are just as important to OCR J277
  • Writing "the program works" as expected output instead of the specific expected output
✅ Notes completed!
Video coming soon
Click slide or press arrow keys to navigate

Worksheet — 2.3.2 Testing

8 questions · 24 marks

Q1Explain the purpose of testing a program. Why is it not enough to simply check the code looks correct?[2]
✅ Mark scheme
Testing runs the program with test data to find errors (bugs) that cause incorrect output, crashes, or unexpected behaviour [1]. Simply reading code (desk checking) may miss runtime errors, logic errors, or edge cases — the program must actually run with specific inputs to verify it behaves correctly [1].
Q2State the three types of test data and describe each with one example for a program that accepts scores from 0 to 100.[6]
✅ Mark scheme
Normal data: valid data within range [1] — e.g. 50 (should be accepted) [1]. Boundary data: data at the edge of the valid range [1] — e.g. 0, 1, 99, 100 (accept) and -1, 101 (reject) [1]. Erroneous data: invalid data that should be rejected [1] — e.g. "abc", -50, 200 (wrong type or far out of range) [1].
Q3Explain the difference between iterative and final testing.[3]
✅ Mark scheme
Iterative testing is carried out during development — each module is tested as it is written to find errors early [1]. Final testing is carried out at the end of development when the complete program is finished [1]. Iterative testing catches bugs early (cheap to fix); final testing checks that all parts work together correctly [1].
Q4Identify the type of error in each case: (a) OUTPUT "Helo" — intended "Hello" (b) total = price + tax, should be price * tax (c) division = 10 / 0[3]
✅ Mark scheme
(a) Logic error [1] — the program runs but produces the wrong output ("Helo" instead of "Hello"). (b) Logic error [1] — wrong operator used; runs but calculates incorrectly. (c) Runtime error [1] — division by zero causes a crash while the program is running.
Q5Describe the difference between alpha testing and beta testing.[2]
✅ Mark scheme
Alpha testing is done in-house by the development team before any public release [1]. Beta testing is done by a limited group of real users outside the company to find remaining bugs and usability issues before the full public launch [1].
Q6For a program that accepts integers from 1 to 10 only, complete the test table below by identifying the category and expected output for each test: Input: 5, Input: 1, Input: 0, Input: "five"[4]
✅ Mark scheme
5 = Normal → accepted / "Valid input" [1]. 1 = Boundary → accepted / "Valid input" [1]. 0 = Boundary → rejected / error message [1]. "five" = Erroneous → rejected / error message [1].
Q7Why is boundary testing particularly important? Give an example of a common programming mistake that boundary testing would catch.[2]
✅ Mark scheme
Boundary testing is important because errors often occur at the edge of allowed values rather than in the middle [1]. Example: a programmer uses age > 0 instead of age >= 0, so 0 is incorrectly rejected. Boundary test with 0 reveals this mistake [1].
Q8A syntax error prevents a program from running. Explain what a syntax error is and give one example.[2]
✅ Mark scheme
A syntax error occurs when the code breaks the rules (grammar) of the programming language, so the translator cannot convert it into executable code [1]. Example: missing keyword, misspelled command (e.g. PINT instead of PRINT), missing bracket, or incorrect indentation in Python [1].
?
out of 24 — self-mark above
Topic Quiz
Question 1 of 15
You scored
out of 15
Card 1 of 10
Click to reveal definition
🎉
Complete!
TermDefinition
🎯

Mini Test — 2.3.2 Testing

10 questions · 10 marks · 10 minutes

← 2.3.1 Defensive Design 2.3 Robust Programs 2.4.1a Boolean Logic →