The score page that refused a full mark
A student builds a quiz score page for the made-up Eastfield Maths Club. The score must be a whole number from 0 to 10. The student types 5 and it works, so the page is done.
On the day, the first pupil to get full marks types 10. The page says it is not allowed. One test would have found it. A plan makes sure the right tests are run.
By the end of this lesson
Note
I can plan tests for an app, run them and give a peer useful feedback.
Key words
| Word | What it means |
|---|---|
| Test plan | a table of the tests to run and what should happen |
| Expected result | what should happen if the app is right |
| Actual result | what really happened when you ran the test |
| Normal data | a sensible value that should work |
| Boundary data | a value right at the edge of what is allowed |
| Erroneous data | a wrong value that should be refused |
The cells students fill in are left blank in this preview.
Starter: what you already know
Have a go
Starter: what you already know
4 questionsYour answers are marked here and are not kept. A college account keeps every student’s marks.
A test plan lists each test
A test plan is a table. For each test it gives the test itself, its purpose, the expected result and the actual result. If they differ, there is a fault. A last column records the error and the action you will take.
Write the expected result before you run the test. If you write it after, you may be tempted to copy what you saw.
Test with three kinds of data
For every input, test three kinds of value. Normal data is a sensible value, such as 5. Boundary data is at the edge, such as 0 and 10, which are the lowest and highest allowed. Erroneous data is wrong and must be refused, such as 11, -1, 3.5, or a blank box.
Faults often hide at the edges.
Try it: test the score page
<h2>Quiz score</h2>
<label for="score">Score (0 to 10)</label>
<input id="score" type="number">
<button id="save">Save</button>
<p id="out" role="status"></p>
<!-- Test 5, 0, 10, 11, -1 and a blank box. Write down each result. -->
A test plan for the score page
| Test | Purpose | Expected | Actual | Error and action |
|---|---|---|---|---|
| Type 5 | Normal data is saved | Saved: 5 | Saved: 5 | None |
| Type 0 | Lowest boundary | Saved: 0 | Saved: 0 | None |
| Type 10 | Highest boundary | Saved: 10 | Please type a whole number | Fault: the check refuses 10. Change >= to > |
| Type 11 | Erroneous data is refused | Please type a whole number | Please type a whole number | None |
| Leave blank | Empty box is refused | Please type a whole number | Please type a whole number | None |
The cells students fill in are left blank in this preview.
Check
Have a go
Check
3 questionsYour answers are marked here and are not kept. A college account keeps every student’s marks.