Testing means running your project with chosen inputs and comparing what happens with what should happen. Validation testing in particular asks what the page does when the input is wrong, empty or extreme.
This lesson belongs to web and project development. It supports the test plan you write when you plan an original assessed project.
What kinds of test data should I use?
Use four kinds: normal, boundary, invalid and empty. Each one catches a different fault.
| Kind | Meaning | Example for a range of 1 to 5 |
|---|---|---|
| Normal | Typical valid value | 3 |
| Boundary | On or beside the limit | 1, 5, 0, 6 |
| Invalid | Wrong type or format | “abc”, 2.5 |
| Empty | Nothing entered | blank |
Boundary values matter most for range checks, because a condition such as qty < 5 instead of qty <= 5 fails only at 5.
Worked example: ticket quantity field
A fictional school event page lets a student book 1 to 5 tickets. The rule: the quantity must be a whole number from 1 to 5.
| Test | Input | Expected | Actual | Result |
|---|---|---|---|---|
| T1 | 3 | Accepted | Accepted | Pass |
| T2 | 1 | Accepted | Accepted | Pass |
| T3 | 5 | Accepted | Rejected | Fail |
| T4 | 6 | Rejected with message | Rejected with message | Pass |
| T5 | abc | Rejected with message | Page shows NaN |
Fail |
| T6 | blank | Rejected with message | Accepted as 0 | Fail |
Three failures show up, and none appears if you only test the value 3. T3 suggests the check uses < 5 where it needs <= 5. T5 and T6 suggest the code never checks that the input is a number or that the box is filled.
After fixing, run all six tests again, not only the failed ones. A change can break a test that passed before.
The mistake: one test and a tick
A weak test set has one normal value and the word “works”.
| Weak testing | Stronger testing |
|---|---|
| Type 3, see it work | Six inputs across four kinds |
| No expected result written | Expected result written before running |
| Only re-run the failed test | Re-run the whole set after a fix |
Write the expected result before you run the test. If you look at the output first, it is easy to decide that whatever appeared was what you wanted.
How do I test interaction, not just input?
Interaction means what the user does: clicking, tabbing, pressing Enter, changing a choice. Treat each action as a test step with an expected response.
For the ticket page, one interaction test is: type 2, press Enter, expect the total to appear without clicking the button. A second is: click the button twice quickly, expect only one booking. Write these in the same table, with steps in the Input column.
Check yourself
A password field accepts 8 to 12 characters. List five test inputs, each with its kind and expected result.
Answer
One good set:
- 10 characters: normal, accepted.
- 8 characters: boundary, accepted.
- 12 characters: boundary, accepted.
- 7 characters: boundary just outside, rejected with a message.
- 13 characters: boundary just outside, rejected with a message.
A sixth test with an empty box (empty kind) is worth adding, expecting a message that the field is required.
What to study next
Record tests so someone else can repeat them. Read documenting your own work on an assessed project, then see the small page testing cluster.
For a teacher to review your test table with you, see online one-to-one Computer Science tuition.