ExamYard Lectures

Test data, testing methods, types of error and writing pseudocode algorithms

A Level Computer Science 9618 · Chapter 12, Software development · 7-minute lecture

The teaching part (1 min) is free to watch. A free account opens the whole lecture: 5 practice questions, 2 real past-paper questions with the answers explained, the mistakes that lose marks, the full-marks tip, a one-card summary and a quick quiz.

What this lecture covers

  1. Prove it works
  2. Kinds of test data
  3. A weight check
Read the transcript of the teaching part

Last time

Before we start: last time, in Selection, iteration and writing algorithms in pseudocode, you learned these points. Here they are again on one card. Keep them in mind, because today builds on them.

Prove it works

A program that seems to work has not been proved. Testing means choosing data cleverly: normal values, awkward edges and nonsense. Then you need to name the kind of error you find, and the stage at which you find it. Finally, you have to write an algorithm from a description. Everything here connects: you write it, then you test it.

Kinds of test data

Normal data is valid and typical. Boundary data is exactly at the edge of the valid range. Abnormal data is invalid and must be rejected. For a range check, test both ends and just outside them. Boundary tests find off-by-one errors, such as using less than instead of at most. A test plan gives the type of data, an example value, the expected result, and a reason.

A weight check

A factory function returns PASS if the weight is from 150 to 155 grams inclusive, otherwise FAIL. Normal: 153 gives PASS. Boundary: 150 gives PASS and 155 gives PASS, because both ends are included. Just outside: 149 gives FAIL and 156 gives FAIL. Abnormal: a negative value, or non-numeric input, gives FAIL.

Chapter 12: Software development

Also for A Level Computer Science 9618

Which topics come up most in A Level Computer Science 9618 past papers, counted from every paper since 2004: Paper 1 topic frequency, Paper 2 topic frequency.