A program is only as trustworthy as the data you feed it. Type your age as "-7" or your email as "banana" and, without checks, the program will happily store nonsense — and rubbish in means rubbish out. Two guards stand at the door: validation, which asks "is this data sensible?", and verification, which asks "was this data entered correctly?". Then careful testing proves the guards actually work.
Validation checks
Validation is an automatic check the computer performs to make sure data is reasonable before it is accepted. It cannot prove data is correct — only that it is plausible.
| Check | What it tests | Example |
|---|---|---|
| Range | Value between limits | Age 0 to 120 |
| Length | Right number of characters | Password ≥ 8 characters |
| Type | Correct data type | Age must be an integer |
| Presence | A value was entered | Surname not left blank |
| Format | Matches a pattern | Date as DD/MM/YYYY |
| Check digit | Extra digit recomputes | ISBN, barcode |
Verification
- Double entry — the data is typed twice and the two copies are compared; if they differ, a typing slip has been caught (common for passwords).
- Visual check — the user reads the entered data on screen and compares it against the original source document.
Note that verification does not make data correct either — you can carefully type the wrong number twice.
Test data: normal, boundary, abnormal
- Normal data — typical values that should be accepted (e.g. 50 for a 1–100 range).
- Boundary data — values right on the edge of what is allowed (1 and 100 should be accepted; 0 and 101 should be rejected). Testing the boundary catches off-by-one errors.
- Abnormal (erroneous) data — values that should be rejected (e.g. -5, 200, or the word "cat").
Testing a validation routine
A trace table lets you follow test data through a routine and check the output. Testing with all three types of data gives confidence the routine handles every case.
| Test data | Type | Expected result |
|---|---|---|
| 50 | Normal | Accepted |
| 1 | Boundary (lowest valid) | Accepted |
| 100 | Boundary (highest valid) | Accepted |
| 0 | Abnormal | Rejected |
| 150 | Abnormal | Rejected |
Normal: 55 (a typical valid mark, accepted).
Boundary: 0 or 100 (the exact edges, accepted); or -1 / 101 (just outside, rejected).
Abnormal: 250 or "pass" (clearly invalid, rejected).
Memory hook: Validation = Valid/sensible, Verification = Verify it was copied right. For test data remember N-B-A: Normal, Boundary, Abnormal.