Data Collection Agent — Estimated build time: 8 hours. Complexity: Moderate.
ID
Scenario
Input
Expected output
Pass criteria
T01
Happy path: scheduled trigger fires on time
Monday 8 am cron trigger fires in sandbox
Agent initialises, authentication to Xero sandbox and Stripe test mode both succeed, run log entry created
Run log shows status 'started'; both auth calls return HTTP 200 within 10 seconds
T02
Happy path: Xero transactions fetched and paginated
Xero demo company with 120 transactions across 7 days, 2 pages of results
All 120 transactions returned in structured payload; page 2 fetched automatically after page 1
Payload transaction count equals 120; no pagination errors in log
T03
Happy path: AR ageing buckets fetched
Xero demo company with invoices in 0-30, 31-60, and 61-90 day buckets
Three AR bucket totals returned with correct invoice counts and amounts
Payload AR section contains three bucket objects; amounts match Xero demo values
T04
Happy path: upcoming bills fetched for 8-week window
Xero demo company with 9 bills due within the next 56 days
9 bill records returned with amounts and due dates; bills outside 56-day window excluded
Payload bills array length equals 9; no bill with due date beyond 56 days present
T05
Happy path: Stripe payout schedule fetched
Stripe test mode account with 3 scheduled payouts
3 payout records returned with amounts and expected arrival dates
Payload payout array length equals 3; arrival dates are future-dated relative to test run date
T06
Failure mode: Xero OAuth token expired
Expired OAuth access token injected into sandbox config
Agent attempts token refresh using stored refresh token; on success, retries the Xero call; on refresh failure, posts alert to Slack staging channel and halts
Xero call retried once after refresh; if refresh fails, Slack alert sent within 60 seconds and run marked 'failed'
T07
Failure mode: Xero API rate limit hit mid-run
Xero sandbox configured to return HTTP 429 after the first API call
Agent pauses for the retry-after period specified in the response header, then retries; up to 3 retries before halting with alert
Retry attempts logged with timestamps; alert fired if all 3 retries exhausted; no duplicate records in payload
T08
Failure mode: Stripe API returns 503 unavailable
Stripe test mode endpoint mocked to return 503
Agent logs the Stripe failure, skips the payout block, flags the payload with 'stripe_unavailable: true', and continues the run with a partial dataset
Payload flag 'stripe_unavailable' set to true; Xero data present; Slack staging alert sent noting partial data
Categorisation Agent — Estimated build time: 8 hours. Complexity: Complex.
ID
Scenario
Input
Expected output
Pass criteria
T09
Happy path: high-confidence transaction matched to chart-of-accounts rule
Transaction description 'AWS Monthly Invoice' against known rule mapping to 'Software and Hosting'
Transaction assigned category 'Software and Hosting'; confidence score above threshold; no flag raised
Category field populated correctly; flagged field is false; confidence score logged
T10
Happy path: full batch of 120 transactions categorised
120-transaction payload from T02 passed to agent
All 120 transactions assigned a category; low-confidence items flagged for review
Output array length equals 120; every item has a non-null category; flagged items contain a reason string
T11
Happy path: low-confidence transaction flagged rather than guessed
Transaction description 'Ref 88291A' with no matching chart-of-accounts rule
Transaction added to flagged list with reason 'no matching rule'; category field set to null
Category field is null; flagged is true; reason string present; item appears in flagged summary
T12
Failure mode: empty transaction payload received
Payload passed to agent with transactions array of length 0
Agent detects empty payload, logs a warning, writes an empty dataset to the staging Sheet tab with a 'no transactions' note, and does not proceed to distribution
Google Sheets staging tab updated with 'no transactions' marker; no PDF export triggered; warning in run log
T13
Failure mode: malformed transaction record in payload
One transaction record missing the 'amount' field
Agent skips the malformed record, logs it with field name and record ID, flags it for human review, and continues categorising the remainder
Skipped record appears in error log with field name 'amount'; remaining records categorised correctly
Distribution Agent — Estimated build time: 6 hours. Complexity: Moderate.
ID
Scenario
Input
Expected output
Pass criteria
T14
Happy path: approval cell set to 'Approved' triggers distribution
Google Sheets staging tab approval cell updated to 'Approved'
Agent detects cell change within polling interval, exports PDF from summary tab, sends email to test address, posts Slack message to staging channel
PDF attachment present in test inbox; Slack message posted within 2 minutes of approval; run log shows 'distribution complete'
T15
Happy path: Gmail send succeeds with correct subject line and attachment
PDF generated from staging Sheet; test recipient address used
Email delivered with subject line matching template, PDF attached, body text populated from standard commentary template
Email received at test address; subject line correct; attachment opens without error; body text non-empty
T16
Failure mode: Gmail API returns 429 rate limit during send
Gmail API mocked to return 429 on first attempt
Agent waits the back-off period and retries up to 3 times; if all retries fail, logs error and alerts via Slack staging channel
Retry count logged; email eventually delivered if retry succeeds; Slack alert fired if all retries exhausted
T17
Failure mode: Slack post fails with channel not found error
Slack staging channel ID set to an invalid value
Agent logs the Slack error, does not halt the run, and sends an internal alert to the FullSpec monitoring channel with the error detail
Gmail send completed successfully regardless; Slack error present in run log; monitoring alert received