n8n capstone: verify the desk against a 20-case test matrix
Run a 20-case matrix covering duplicates, rejection, interruption, ambiguous dates, denied permissions, timeouts and cancelled sessions with zero unintended bookings.
By Invicly Tech, , in n8n, AI Automation and Voice Agents. About 8 minutes to read.
In short
You prove the desk is safe with a fixed matrix of 20 cases. Each case has an input, an expected state and an expected calendar result. The rule is simple: zero unintended or duplicate bookings.
Think of it like this: It is a fire drill: you trigger the bad day on purpose, on a quiet afternoon, and watch what happens.
Explained simply
Now you test the desk on purpose with bad days. You use a table of 20 cases. Each row says what goes in, what state you expect and what the calendar should look like afterwards.
Some cases repeat an event, so a duplicate tries to sneak in. Some reject a proposal or let it expire. Some interrupt the caller, cancel the session or drop the connection halfway. Others use unclear dates, deny a reviewer permission or force a timeout.
For each case you check three places: the state of the proposal, the calendar, and the audit record. All three must match the table. A run that shows no error but leaves a stray booking has failed.
The pass rule is strict. All 20 cases end as expected, and across the whole suite there are zero duplicate and zero unauthorised bookings. If one case fails, fix it and rerun all 20.
Press Play on a diagram to walk through it one step at a time.
- Duplicates
- Same event twice
- Replay after success
- Lost acknowledgement
- Review outcomes
- Approve
- Reject
- Expire with no answer
- Session problems
- Caller interrupts
- Session cancelled
- Disconnect mid turn
- Bad input
- Ambiguous date
- Past date
- Unknown service
- Access and timing
- Denied reviewer
- Tool timeout
- Slot taken meanwhile
- Expected state
- Reason recorded
- No stuck pending
- Entries by event key
- At most one each
- None if not approved
- One record per run
- IDs present
- No audio or personal data
In depth
Shape of a good test case
A case is a small contract. It has an ID, a setup, an input, the expected proposal state, the expected calendar entries and the expected audit lines.
Reset the mock calendar before every case so cases cannot affect each other. Use fixed fixture inputs so a failing case fails the same way each time.
In n8n you can pin data on the webhook node to rerun a case with the same input, and open the execution to see what each node did. The docs on pinning and debugging executions describe how.
- ID, setup, input
- Expected state
- Expected calendar entries
- Expected audit lines
- Reset between cases
Duplicates, rejection and expiry
Duplicate cases: the same event sent twice at once, the same event replayed after success, and a write whose acknowledgement was lost. Expected result: one booking at most.
Rejection and expiry cases: a reviewer rejects with a reason, and a reviewer never answers. Expected result: rejected or expired, calendar unchanged.
The most useful check is on the calendar, not on the workflow. Count entries by event key. Anything above one is a failure, and so is any entry for a proposal that was not approved.
- Fixture runner to n8n: Event evt_9 (first time)1Event evt_9 (first time)
- n8n to Mock calendar: Apply evt_92Apply evt_9
- Mock calendar to n8n: Confirmed3Confirmed
- Fixture runner to n8n: Event evt_9 (replay)4Event evt_9 (replay)
- n8n to Fixture runner: Duplicate noted, no new booking5Duplicate noted, no new booking
Interruptions, cancellations and ambiguity
Interruption cases: the caller speaks over a slot read-back, changes their mind mid sentence, or ends the session before confirming. The expected result is that no proposal is sent, or a sent proposal is marked cancelled.
Ambiguity cases: next Friday, a date in the past, or a service name that does not exist. The assistant should ask a short question instead of guessing.
In all of these, the calendar must stay empty unless the full path ran: offered, confirmed by the caller, proposed, approved.
- Interrupted read-back: nothing sent
- Cancelled session: proposal cancelled
- Unclear date: ask, do not guess
- Past date: refuse politely
Denied permissions, timeouts and reading the results
Permission cases: a reviewer who is not on the approved list, a missing credential, and an expired token. Each must be refused and logged, with no booking.
Timeout cases: the availability tool is slow, and the calendar write is slow. The first leads to a spoken apology. The second must end in failed or a safe retry that cannot double book.
Write results in a table with pass or fail and a link to the execution. Keep a short redacted trace for one case of each group as evidence.
- Unlisted reviewer: refused, logged
- Slow tool: apology, no invention
- Slow write: failed or safe retry
- Record pass or fail with execution link
Learn it in 5 short steps
About 1h 10m each. Track them with a timer in your plan.
- 1Replay duplicate events~1h 10m
- 2Reject and expire proposals~1h 10m
- 3Interrupt and cancel sessions~1h 10m
- 4Force timeouts and denied permissions~1h 10m
- 5Confirm zero duplicate bookings~1h 10m
Key points
- Each case lists input, expected state, expected calendar entries and expected audit lines.
- Duplicate and replayed events must end with exactly one booking or none.
- Rejected, expired and cancelled proposals must leave the calendar untouched.
- Denied permissions and timeouts must fail safely and be visible in the audit record.
- n8n pinned data and the execution list let you rerun a case and see what each node did.
Key terms
Tap a card to flip it. 0/5 known
Examples
Three rows of the matrix
Each row lists what you send, what state you expect and what the calendar must show. Case 03 sends the same event twice. Case 11 has the reviewer reject. Case 17 uses a reviewer who is not approved. All three must leave at most one booking, and cases 11 and 17 must leave none.
id input state bookings
03 evt_a sent twice confirmed 1
11 evt_b, reviewer rejects rejected 0
17 evt_c, reviewer unlisted pending 0
(call refused, 401 in audit)A script that counts duplicates
After the suite, ask the mock calendar for its bookings and group them by event key. Print any key with more than one entry, and fail the run if there is one.
curl -s localhost:8081/bookings \
| jq -r '.[].eventKey' | sort | uniq -d > dups.txt
if [ -s dups.txt ]; then
echo "FAIL: duplicates"; cat dups.txt; exit 1
fi
echo "PASS: zero duplicates"Quick reference
- 20 cases: duplicates, review outcomes, sessions, bad input, access, timing.
- Each case: input, expected state, expected calendar, expected audit.
- Reset the mock calendar before every case.
- Pin webhook data in n8n to rerun a case with the same input.
- Count bookings by event key. More than one is a failure.
- Unauthorised or rejected proposals must leave the calendar unchanged.
- If one case fails, fix and rerun all 20.
Common mistakes
- Only testing the happy path. Most value comes from the failure cases.
- Counting a run as passed because no error showed, without checking the calendar.
- Letting one case leave data behind that changes the next case. Reset the mock calendar between cases.
Quick quiz
Pick an answer to see if you're right and why.
Practice exercises
Try each one yourself first. Use the hint if you get stuck, then compare with the solution.
- Exercise 1easy
Write the table for 5 of the 20 cases with input, expected state and bookings.
- Exercise 2medium
Run the duplicate cases and prove one booking per event key.
- Exercise 3hard
Force a timeout on the calendar write after it succeeded, and show retry does not double book.
Check yourself
Answer in your head, reveal, then be honest with yourself.
Feel confident about this topic?
Frequently asked questions
- Why 20 cases?
- It is enough to cover each risk group a few times without becoming a burden to run.
- How do I test an interruption without a microphone?
- Send fixed transcript lines that simulate it, such as a new line before the previous read-back finishes.
- What if a case fails sometimes?
- Treat it as a failure. Flaky results often mean a race or a missing reset.
- Do I need a real model for the matrix?
- No. Use scripted or deterministic transcript mode so results repeat.