A replay test matrix for n8n workflow and model releases
Replay workflow fixtures across prompt, model and workflow changes and check errors, retries, approval state and rollback thresholds.
By Invicly Tech, , in n8n, AI Automation and Voice Agents. About 8 minutes to read.
In short
Before you change a prompt, a model or an n8n workflow, you replay the same fixtures and compare. A test matrix is a table of cases against the things that can go wrong: webhook errors, retries, approval state. You also write down in advance how bad a result must be before you roll back.
Think of it like this: It is a pre-flight checklist: the same items every flight, and a rule for when you do not take off.
Explained simply
Every time you change a prompt, a model or an n8n workflow, something else can break. The fix is to replay the same set of test cases after each change and compare the results with the last good run.
A test matrix is just a table. Down the side are your cases. Across the top are the things you check: does the workflow handle a bad webhook, does a retry end in exactly one action, and does each approval state behave.
Some checks matter more than others. A rejected or expired proposal must never leave a confirmed booking behind. A retry after a failure must not book twice. These are the ones that block a release.
Before you start, decide your rollback thresholds. For example, zero wrong bookings and no big drop in scores. Writing the limits first means you cannot bend them to fit the results.
Press Play on a diagram to walk through it one step at a time.
- 1Change
Prompt, model or workflow edit
- 2Replay fixtures
Run the whole set on a test copy
- 3Check the matrix
Errors, retries, approval state
- 4Compare to thresholds
Pass or fail each gate
- 5Release or roll back
Keep the previous version ready
- 1Outcome scores
Intent, completion, wrong bookings
- 2Approval state
Pending, approved, rejected, expired
- 3Retry recovery
A transient failure ends in one action
- 4Webhook handling
Bad input gets a clear error, not a crash
- Wrong bookings
- Duplicate bookings
- Bookings from rejected or expired proposals
- Intent accuracy
- Read-back accuracy
- Latency within the agreed margin
In depth
Replay on every change
Keep the workflow fixtures next to the voice fixtures. A workflow fixture is an input event, such as a proposal from the voice agent, with an expected result in the mock calendar and the audit record. Run all of them on a test copy of the workflow whenever the prompt, the model or the workflow JSON changes. Save the output next to the previous run so you can compare line by line. n8n can export and import workflows as JSON, which makes a test copy easy to create.
- All fixtures, not only the edited one
- Run on a copy, not live
- Keep the last good result
- Record versions of each part
Webhook errors and retries
Send the webhook bad input: a missing field, a wrong signature, the same event twice. The right behaviour is a clear error response and no side effects. Then force a transient failure, for example by making the mock calendar fail on the first call. The workflow should retry within its limit and end with exactly one booking. Also force a permanent failure and check that it goes to review and not into an endless retry loop.
- Missing or invalid fields
- Duplicate event
- Transient failure then success
- Permanent failure goes to review
- Test runner to n8n workflow: Approved proposal event1Approved proposal event
- n8n workflow to Mock calendar: Create booking, key K12Create booking, key K1
- Mock calendar to n8n workflow: Forced error3Forced error
- n8n workflow to Mock calendar: Retry with the same key K14Retry with the same key K1
- Mock calendar to n8n workflow: Booking created once5Booking created once
- n8n workflow to Test runner: Audit record, one action6Audit record, one action
Approval states
A proposal moves through states: pending, approved, rejected and expired, and sometimes failed. Test each one. Pending must not touch the calendar. Rejected must close the proposal and tell the caller. Expired must not book silently if someone approves late. Only approved may write, and only once. Check the state in the audit record and in the calendar, because a mismatch between them is itself a bug.
- Open
- Pending
- Closed without booking
- Rejected
- Expired
- Cancelled
- Closed with booking
- Approved and written
- Problem
- Failed, needs review
Rollback thresholds
A threshold is a rule that says stop. Write them before you test. Examples: any wrong or duplicate booking blocks the release; outcome scores may not drop by more than an agreed margin; P95 latency may not rise by more than a set amount. If a gate fails, redeploy the previous exported workflow and the previous prompt and model settings. Keep those exports so rollback takes minutes, not a rebuild. Source control and environments in n8n is a paid feature, so on other plans keep exported JSON in your own Git repository.
Learn it in 5 short steps
About 35m each. Track them with a timer in your plan.
- 1Replay fixtures on each change~35m
- 2Check webhook error handling~35m
- 3Check retry recovery~35m
- 4Check approval states~35m
- 5Set rollback thresholds~35m
Key points
- Replay the full fixture set on every prompt, model or workflow change, not just the case you edited.
- Test the webhook with bad input: missing fields, wrong signature, duplicate event. It should answer clearly and do nothing unsafe.
- Check retry recovery: a forced failure followed by a retry must end in exactly one action.
- Check each approval state, including rejected and expired, never leaves a confirmed booking behind.
- Set rollback thresholds before the change, such as zero wrong bookings and no drop beyond an agreed margin.
Key terms
Tap a card to flip it. 0/5 known
Examples
Duplicate webhook replay
Send the same approved event twice with the same event ID. The first run creates one booking. The second should be recognised and skipped. The matrix row passes if the calendar holds exactly one booking and the audit record shows one write and one skip.
BODY='{"event_id":"evt-001","proposal_id":"p-77","state":"approved"}'
for i in 1 2; do
curl -s -X POST https://n8n.example.com/webhook-test/approve \
-H 'Content-Type: application/json' -d "$BODY"
done
# expect: one booking, second call reports duplicateA rollback decision
A model change raised intent accuracy by one point but caused one duplicate booking in the retry case. The rule says any duplicate blocks the release. You redeploy the previous workflow export and keep the old model setting, then write the failing case as a new fixture.
Quick reference
- Replay every fixture on each prompt, model or workflow change.
- Run replays on a test copy of the workflow.
- Webhook tests: missing field, bad signature, duplicate event.
- A forced retry must end with exactly one action.
- Pending, rejected and expired proposals never write to the calendar.
- Set rollback thresholds before testing, and keep the last export.
Common mistakes
- Setting thresholds after seeing the results, so they always conveniently pass.
- Testing a workflow edit on the live instance instead of a copy.
- Forgetting that n8n source control and environments is a paid feature, and having no other way to keep versions of the workflow JSON.
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
List the four proposal states a matrix should cover, and say which one may write to the calendar.
- Exercise 2medium
Write three webhook test inputs and the expected response for each.
- Exercise 3hard
Write a release checklist with four gates and a rollback step, including how you keep workflow versions without paid source control.
Check yourself
Answer in your head, reveal, then be honest with yourself.
Feel confident about this topic?
Frequently asked questions
- How do I get a test copy of an n8n workflow?
- Export it as JSON and import it into a test instance or as a new workflow, then point it at mock services.
- Does n8n have built-in tools for testing AI workflows?
- n8n documents ways to test and improve AI workflows. Check its current docs for what your version and plan include.
- What if a threshold fails but the change looks harmless?
- Treat the result as the rule. Investigate the failing case, fix it, and replay. Do not move the threshold.