The MOT before the car goes out
Before a car can go on the road each year, a tester checks it against a list: brakes, lights, tyres, seat belts. Each check passes or fails, and the result is written down.
A failed check is fixed, then checked again.
Your app gets the same treatment before it goes to the client.
Key words
| Word | What it means | Example |
|---|---|---|
| Test log | A table of every test: what was done, what should happen, what did happen. | |
| Acceptance criteria | Pass or fail checks that show a story is finished. | |
| Normal data | Sensible input the app should accept. | a 20 letter title |
| Boundary data | Input right at the edge of what is allowed. | 150 and 151 letters |
| Erroneous data | Wrong input the app should refuse. | tier=abc |
| Black box testing | Testing what the app does, without looking at the code. |
The cells students fill in are left blank in this preview.
By the end of this lesson
Note
I can test an app by hand against its acceptance criteria and record the results.
Starter: what you already know
Have a go
Starter: what you already know
3 questionsThe review sprint, step 15: the goal
| Part | For this step |
|---|---|
| Sprint (a short block of work) | Review: check the whole app and document how it was made. |
| This step | Test every story by hand, record each result in the test log, fix what fails and test again. |
| Stories | All of them, from E1 to E6. Each test names the one it checks. |
The cells students fill in are left blank in this preview.
Every test checks one criterion
Start from your acceptance criteria from Task 1. Each one becomes at least one test.
Test with three kinds of input. Normal data should be accepted. Boundary data sits right at the edge, such as 150 and 151 letters. Erroneous data should be refused with a clear message.
Test as each role. Test what a browser would never send, by changing a form value in the browser's tools.
Worked example: four rows of a test log
| ID | Test and criterion | Steps | Expected | Actual | Result |
|---|---|---|---|---|---|
| T12 | Empty request form (E2.1, E6.4) | Send the form with every box empty | Each problem listed and linked to its box | Four messages, each a link and beside its box | Pass |
| T19 | Escalate needs a reason (E2.4) | Escalate NTH-0013 with no reason, then with one | Refused, then moved to Tier 2 | Refused with a message, then Tier 2 | Pass |
| T30 | Long job title (E3.1, E6.4) | Send a 300 letter title from the browser's tools | Refused | Saved: only the browser stopped it | Fail, fixed, retested: pass |
| T35 | Another engineer's brief (E1.2, E3.3) | As tier2, open Priya's job by its address | Error 403 | Error 403 | Pass |
The cells students fill in are left blank in this preview.
Check: planning tests
Have a go
Check: planning tests
3 questionsMatch each input to its kind of data
Have a go
Loading…
Your answers are marked here and are not kept. A college account keeps every student’s marks.
A failed test is a gift
When a test fails, write down what really happened. Then debug: find the cause, by reading the code and trying again.
Fix it, put a short comment in the code naming the test, and run the same test again. Record the fix and the new result.
The companion app ran fifty tests. Six failed, and every one was fixed and retested. That is the iteration (another round of improvement) the task wants to see.
Fix for T21: no escalating a finished request
# helpdesk/tickets.py, inside escalate(ticket_id), after test T21 failed
# Test log T21: a resolved or closed request could be escalated, which left
# it unassigned at a higher tier with nobody needing to act.
if ticket.status not in ["new", "open", "waiting"]:
flash("Only open requests can be escalated. Reopen it with an update first.")
elif not new_tier.isdigit() or int(new_tier) not in TIERS or int(new_tier) <= ticket.tier:
flash("Choose a higher tier to escalate to.")
Make a free account to save your work and track your progress.
Fix for T30: check the title length
# helpdesk/jobs.py, inside check_job_form, after test T30 failed
values["title"] = form.get("title", "").strip()
if not values["title"]:
errors["title"] = "Enter a title for the job."
elif len(values["title"]) > 150:
# Test log T30: only the browser's maxlength stopped long titles.
errors["title"] = "The title must be 150 characters or fewer."
Make a free account to save your work and track your progress.
Check: after a failed test
Have a go
Check: after a failed test
3 questionsA common mistake
Warning
Many students hide failed tests, so the log shows only passes. A log of all passes looks like the testing was too easy. Record every failure, the fix and the retest. Finding and fixing faults is exactly what earns credit.
Three kinds of change that testing finds
| Kind | What it is | Example from the companion app |
|---|---|---|
| Error | Wrong output or a crash | Escalating a resolved request left nobody to act (T21) |
| Refinement | Works, but could be better made | Article views counted on every reload, so now once per person (T41) |
| Improvement | Better for users or the business | Customers are now told when a visit is cancelled (T36) |
The cells students fill in are left blank in this preview.
Test more than the forms
Work out each KPI (a number the client watches) by hand from the sample data and compare it with the reports page.
Check accessibility (use by everyone): Tab through each page, check every box has a label, and turn on larger text and high contrast. Check other browsers and a phone. Ask a classmate to review a page of your code.
End the log honestly with what is left to test, such as a session with a screen reader.
Check: wider testing
Have a go
Check: wider testing
3 questionsYour turn: your own test log
Write a test log for your app with at least twenty tests. Use the columns: ID, test, story or criterion, steps, expected, actual, pass or fail, fix. Cover every epic, every role, and normal, boundary and erroneous data. Include at least three tests a normal browser would not send, by changing a form value in the browser's tools. Check two KPIs by hand. For every failure, fix it, add a comment naming the test, retest, and record the result. End with a short list of what is still left to test.
A teacher marks this in a college. Nothing you write here is kept: it goes when you leave the page.
Make a free account to save your work, or press Start lab to work through the whole lesson.
Compare with the step 15 code
Tip
Read the full test log in the step 15 code on GitHub, in docs/test-log.md. Search the code for "Test log T" to find every fix.
Change log entry for step 15
| Date | Version and files | What changed | Why |
|---|---|---|---|
| 23 March | step-15: test-log.md, tickets.py, jobs.py, articles.py, main.py, tickets/detail.html | Fifty manual tests recorded; six failures fixed and retested | To show the app meets its criteria and to find what reading the code missed |
The cells students fill in are left blank in this preview.
Next: the change and source log
In step 16, the last step, you finish the change and source log. It credits everything made by others, including code from an AI coding assistant. You also write the README and record the screencast.
Exit quiz
Have a go