Validation, verification and test data

Computer Science · Algorithm design and problem-solving. The idea in plain words, the rules to remember, the mistake to avoid and a worked example, written and checked by Mega Lecture.

Test this topic freeAll Computer Science topics

The idea

Validation is an automatic check by the program that data is reasonable and follows the rules before it is accepted. It cannot tell whether the data is correct: an age typed as 43 in place of 34 still passes a range check.

Verification checks that data has been entered or copied without change. It compares what was entered with the original. The two methods are a visual check and a double entry check.

Test data is chosen to show that a program works. A good test uses data the program should accept, data it should reject, and data at the limits of what is allowed.

In simpler words

Validation is a check by the program that data is sensible before it is accepted, such as an age between 0 and 120. It cannot tell if the data is actually right. Verification checks that data was typed or copied without mistakes, by looking again or typing it twice. Test data checks a program works with normal, abnormal, extreme and boundary values.

An everyday comparison

Validation is like a bouncer checking that a ticket looks genuine and is for tonight's date. It cannot tell if the ticket belongs to the person holding it. Verification is like reading your phone number back to the caller to check it was written down correctly. The comparison stops working because validation is done automatically by the program, never by a person.

Rules to remember

Common mistake

Students mix up extreme and boundary data. Extreme values are both accepted; a boundary pair has one accepted value and one rejected value.

In the exam

Name the check and describe exactly what it tests, using the scenario's field: a range check on age tests it is between 0 and 120. Distinguish validation from verification clearly. For test data, give a specific value for each type and say whether it is accepted or rejected, with a reason. For boundary data, give the pair at a limit: one accepted, one rejected.

Worked example

A program accepts a student's age as a whole number from 11 to 18 inclusive. Give normal, abnormal, extreme and boundary test data.

  1. Normal: any value well inside the range, for example 14, which should be accepted.
  2. Abnormal: a value that should be rejected, for example 25 or the word 'twelve'.
  3. Extreme: the smallest and largest accepted values, which are 11 and 18.
  4. Boundary: 10 and 11 at the lower limit, 18 and 19 at the upper limit. 10 and 19 are rejected.

Answer: Normal 14; abnormal 25; extreme 11 and 18; boundary 10 with 11, and 18 with 19.

Ask about this

Type what you are stuck on. The helper finds the explanation, worked examples and the notes to read, free and instant.

Keep going

← Standard methods of solutionTrace tables and correcting algorithms →Take a Computer Science test