GCSE · Computer Science · OCR · Spec J277
Purpose of testing
Every part of your app passed its tests. You join them up, press go… and something breaks. How? That's why testing never happens just once.
Computer Science · Testing
Priya builds a cinema booking program
Pick a moment from Priya's build, then pick the kind of testing it shows.
Still to sort
Iterative testing (0)
One section of code, tested as soon as it's written.
Where the line is: Only one newly written section is being checked, and its errors get sorted before the next section is started.
Integration testing (0)
Modules that passed on their own, now tested together.
Where the line is: The modules have already been tested separately. Joining two of them mid-build isn't the same as testing the finished program.
Final testing (0)
The finished program, tested as a whole. The last phase.
Where the line is: This waits until the program is considered completely finished. If parts are still being written, it isn't final testing yet.
Priya writes her program in three modules: ticket price, seat picker and payment. Follow her through the build. At each moment, decide what kind of testing she's doing. Commit first, then read why.
Computer Science · Testing
Test table: Priya's ticket prices
The rule Priya's program should follow: under-16s pay £5, everyone else pays £8. Each step adds one test to the table.
Step through the tests. Keep your eyes on Expected and Actual: the moment they disagree, something's wrong.
| Test | Description | Input | Expected | Actual | How fixed |
|---|---|---|---|---|---|
| 1 | Child ticket | 10 | £5 | £5 |
Output
Step 1: Expected £5, got £5. Test 1 passes, so there's nothing to fill in under How fixed.
Each row is one test. Expected is decided before the test runs; Actual is only known once it has run.
WHAT YOU'VE LEARNED
A quick recap of today's lesson.
Testing isn't one big check at the end. Code gets tested as it's written, again when the parts are joined, and finally as a whole.
What you need to know
- Testing checks a program works correctly, meets its requirements and is free from bugs or errors.
- It catches errors before users meet them, checks different inputs work as expected, and improves reliability and user experience.
- Testing happens throughout development. The overall approach is agreed and planned to suit what the system is required to do.
- Iterative testing (also called module or unit testing): write a section, test it, fix its errors, then start the next one.
Have a goYou've just written the 'add to basket' section of a shop program, and you're itching to start the checkout section. Using iterative testing, what has to happen first?
Test the basket section and fix its errors.
Iterative testing resolves each section's errors before the next section is developed; saving them all up for later is exactly what it avoids.
- Integration testing takes modules already tested separately and tests them together, to check they're compatible and work as expected.
- Why bother? A module that works on its own may cause errors once it's part of the wider system.
Have a goYour mate's two modules both passed their own tests. "Joined them up. No need to test again, they're both perfect," he says, already reaching for the crisps. Is he right?
No. They still need testing together.
Passing alone doesn't prove they'll work together: a module that works on its own may still cause errors once it's part of the wider system.
- Final testing is the last phase, once the program's considered finished: every pathway, a full range of input data.
- White box: the test designer looks in detail at the code and how it works. Black box: checks what it does, not how it's coded.
Have a goA tester reads through the if statement that sets ticket prices, works out how it decides each price, then designs tests from that. White box or black box?
White box.
She's looking in detail at the code and how it works. Black box would check the prices that come out without looking at how it's coded.
- A test table's headings include test number, description, input, expected output, actual output, and how a failed test was fixed.
- A failed test may mean a bug. Debugging finds and corrects it, so the program works correctly and meets its functional requirements.
The big picture
Testing checks that a program works correctly, meets its requirements and is free from bugs or errors, so problems are found and fixed before users meet them. It happens throughout development: iterative testing checks each new section as it's written, integration testing checks that modules already tested on their own work together, and final testing checks the finished program as a whole. White box testing looks in detail at the code; black box testing checks what the system does without looking at how it's coded. Results go in a test table, and a failed test may mean a bug that needs debugging.
Key points
Worked example
Problem
A student wrote: "Integration testing is when you test the whole program at the end to check it all works." Improve this answer.
⚠ Watch out
Mixing up white box and black box. Black box testing doesn't look at how the code works; it checks the system does what it's supposed to. White box is the one where the test designer looks in detail at the code.
Memory hook
Build a bit, test a bit (iterative). Join the bits, test the joins (integration). Finish it, test the lot (final).
Check yourself
Without looking back: name the three kinds of testing in the order they happen during development, and say in one line what makes white box testing different from black box testing.
Flashcards
(14)What is software testing?
How does testing help the people who will use a program?
Why test a program with more than one input?
When is testing carried out?
Iterative testing is also known as…
What happens in iterative testing?
What is integration testing?
Why can't you skip integration testing when every module has passed?
When does final testing happen?
What does final testing check?
White box testing
Black box testing
Headings in a test table
What is debugging, and why does it matter?
Tap any card to flip it, or use Study as deck to go through them one at a time. In the full lesson these run as a spaced-repetition deck — you rate each card Hard, Good or Easy and the tricky ones keep coming back until they stick.
Learning with Lightbulb is opening soon
You can use this lesson now. Join the waitlist and we'll let you know when the full Lightbulb experience is ready.
Keep me postedMore OCR GCSE Computer Science topics
How this lesson was checked. This OCR GCSE Computer Science (specification J277)lesson was published through Lightbulb Learning's human-designed editorial process — the educational standards, accuracy rules and publication checks it must pass were authored and approved by Philip Halpin. It passed subject-specific assessment, automated educational checks and technical publication verification before going live (publication checks completed 3 November 2026). Published pages are monitored, human spot-checking is ongoing across the lesson library, and anything found wrong is corrected or withdrawn. How our lessons are made and checked. Spotted a mistake? Email hello@lightbulblearning.co and we'll review it.