Free revision guides

Testing: test data and test tables

National 5 Computing Science: Software design and development, Web design and development

Testing checks that a program does what it should. In National 5 Computing Science you choose test data, predict the expected output, and explain what a result shows. Choosing the data is usually done well. Explaining why, and working out the expected output properly, is where marks go.

Three kinds of test data

Take a program that accepts a shoe size from 3 to 13 inclusive.

KindMeaningExamples
NormalValid data inside the range5, 8, 11
ExtremeValid data on the limits of the range3 and 13
ExceptionalData that should be rejected: outside the range or the wrong type2, 14, 8.5, "ten"

Extreme data is valid: 3 and 13 should both be accepted. That catches the most common bug, a wrong operator such as < where <= was needed.

What gains the mark
  • "3 and 13 are extreme data, on the limits of the range. They check that the boundaries are accepted, for example that <= has been used and not <."
  • "To check the program rejects them." Extreme data is valid, so it should be accepted.
  • "Extreme data is very big numbers." Extreme means the limits of the range, whatever they are.

Test tables

A test table lists each test, the expected output and the actual output. Here "Rejected" means the program displayed its error message and asked again.

Test dataKindExpectedActual
8NormalAcceptedAccepted
13ExtremeAcceptedRejected
14ExceptionalRejectedRejected

The second row shows a problem: 13 should be accepted but was rejected. That is a logic error, probably size < 13 where size <= 13 was needed. The program runs, but gives the wrong result.

  • Work out the expected output yourself, by hand, before running the program. The examiners noticed candidates copying the program's own output as the expected result. If the program is wrong, the test then "passes" and the error is never found.
  • When a question asks for another test, choose one that is not already in the question. Repeating a given test does not gain the mark.

Testing a website

In web design and development the same idea applies: compare what you see with what was planned. Check that each page matches its wireframe, that every link goes to the right page, that images, audio and video display or play, and that the pages are consistent with each other.

When a test fails, the developer goes back to fix it: see iterative development. For validation, the algorithm most often tested with extreme data, see input validation.

Try two exam-style questions

Choose an answer, say how sure you are, then press Check. Every wrong answer tells you why it is wrong.

The Test data sorter simulation
In the course: Test data sorter. Sort test values into normal, extreme and exceptional for a range, and see whether the program would accept or reject each one.

The full course covers every topic like this. Every topic in National 5 Computing Science has a short note, a simulation to try and a practice quiz with feedback on every answer, plus coding lessons, a full mock exam and a progress report for parents.

Create an accountTry more for freeAbout the course

More guides

This site is independent: it is not connected to the SQA or Qualifications Scotland. Points from the examiners' course reports are given in our own words.