"The data looks fine to me"
A treasurer scrolls through a list of 14 deposits and says it looks fine. It is not fine. Two rows are the same. One amount is the word "twenty".
Your eyes miss things. A test does not. And a written test can be shown to somebody else.
Key words
| Word | What it means |
|---|---|
| Test | a check that finds out if something is right |
| Test data | the values you feed into a test |
| Expected result | what should happen, written before the test |
| Actual result | what really happened |
| Defect | a fault in the data or the model |
| Annotation | a short note that explains a piece of evidence |
| Model | the set of tables or calculations that turns data into answers |
The cells students fill in are left blank in this preview.
By the end of this lesson
Note
I can record a data test as annotated evidence, from the test to the fix.
Starter
Have a go
Starter
3 questionsYour answers are marked here and are not kept. A college account keeps every student’s marks.
This is practice
Important
The real task comes from the exam board. This lesson uses an invented organisation and its own made-up data. Your teacher tells you how the real tasks are set and what you may bring.
The columns of a test log
| Column | What you write | Example |
|---|---|---|
| Test | What you check | Are any deposit rows repeated? |
| Purpose | Why you check it | A repeat makes a total too big |
| Test data | What you feed in | All 14 rows |
| Expected | What should happen | 0 repeated groups |
| Actual | What really happened | 1 repeated group |
| Comparison | Do they match? | No |
| Issue | What the defect is | Row 4 repeats row 2 |
| Fix | What to do about it | Remove row 4 and re-test |
The cells students fill in are left blank in this preview.
Run test 1 and test 2
SELECT COUNT(*) AS rows_found FROM deposit;
SELECT member_ref, deposit_date, amount, branch, COUNT(*) AS times
FROM deposit
GROUP BY member_ref, deposit_date, amount, branch
HAVING COUNT(*) > 1;Worked example: a log from those runs
| Test | Test data | Expected | Actual | Match | Issue and fix |
|---|---|---|---|---|---|
| T1 Row count | All rows | 14 | 14 | Yes | None |
| T2 Repeated rows | All rows | 0 groups | 1 group: M002 on 5 Jan, 40, North | No | Row 4 repeats row 2. Remove row 4 |
| T3 Missing amount | Amount column | 0 empty | 1 empty: row 5 | No | No amount. Ask the branch, or leave out of totals |
| T4 Amount is a number | Amount column | All numbers | Row 6 holds the word twenty | No | Typing slip. Correct to 20 if the slip is checked |
The cells students fill in are left blank in this preview.
Annotate, do not only paste
An annotation says what the result means. For T2 you might write: "The same member, date, amount and branch appear twice. The ids differ, so it is probably typed in twice."
One sentence turns a result into evidence. It also shows you understand the model.