Integration tests (T15 to T22) validate the handoff between the Reorder Calculation Agent and the PO Dispatch and Tracking Agent, as well as the reliability of each external tool connection under realistic load. All tests run in the sandbox environment. Edge-case tests (E01 to E07) cover the failure and boundary scenarios most likely to occur in production.
ID
Scenario
Input
Expected Output
Pass Criteria
T15
Full agent handoff: Reorder Calculation Agent output consumed by PO Dispatch Agent
Cin7 sandbox triggers on TEST-001 at reorder point; Reorder Calculation Agent produces draft PO data object
PO Dispatch Agent receives the data object within 5 seconds; PO creation begins immediately; no manual intervention required
No data loss between agents; PO Dispatch Agent log shows correct PO ID, SKU, quantity, and supplier; latency under 5 seconds
T16
Batch trigger: three SKUs hit reorder point simultaneously
Cin7 sandbox poll returns three SKUs (TEST-001, TEST-002, TEST-007) all at or below reorder point in the same polling interval
Three separate Reorder Calculation Agent executions fire concurrently; three independent PO Dispatch flows complete without cross-contamination
Three distinct POs created in Cin7 sandbox; three separate Google Sheets rows appended; no SKU data mixed between records
T17
Google Sheets append under concurrent writes
Two PO Dispatch flows attempt to append rows to the tracking sheet within the same second
Both rows appended correctly; no row overwritten; row order reflects dispatch timestamps
Google Sheets test file contains exactly two new rows; both rows contain accurate data; no blank or overwritten rows
T18
Slack approval message delivered to correct channel and user
Above-threshold PO for TEST-009 (value $950); Slack test workspace with operations channel and test manager user
Slack message delivered to operations channel; message body includes SKU, supplier, quantity, value, and approve/reject action buttons
Message appears in correct channel within 30 seconds; both buttons functional; message text matches PO data exactly
T19
Xero bill linked correctly to supplier record
PO Dispatch Agent creates Xero bill for TEST-001 PO; supplier 'Sandbox Supplier A' exists in Xero demo company
Draft bill created in Xero with correct contact, reference (PO number), amount, and due date derived from lead time
Xero demo bill record shows correct contact, amount matches PO value, PO number in reference field, status is Draft
T20
Cin7 PO status updated to 'Sent' after dispatch
PO created in Cin7 sandbox as Draft; Gmail dispatch step completes successfully
Cin7 PO status updated to Sent via API PATCH call; status visible in Cin7 sandbox UI
GET /purchaseorders/{id} returns status = Sent after dispatch; no intermediate status states persisted incorrectly
T21
Reorder Calculation Agent output schema mismatch
Agent produces a draft PO data object with a missing 'supplier_email' field (simulated schema corruption)
PO Dispatch Agent detects missing required field; halts execution; logs schema validation error with field name; no partial PO created
Error log entry includes field name 'supplier_email' and execution ID; no Cin7 PO record created; no emails sent
T22
End-to-end latency within acceptable threshold
Single SKU at reorder point in Cin7 sandbox; sub-threshold order value
Time from Cin7 poll trigger to Google Sheets row appended is under 3 minutes
Timestamp comparison between trigger event log and Sheets append log shows elapsed time under 180 seconds
ID
Scenario
Input
Expected Output
Pass Criteria
E01
Duplicate trigger: same SKU fires twice in the same polling interval
Cin7 sandbox returns the same SKU at reorder point in two consecutive poll results before the first workflow completes
Deduplication logic detects the duplicate workflow ID or SKU-plus-timestamp combination; second execution is suppressed; single PO created
Cin7 sandbox contains exactly one PO for the SKU; log shows deduplication event for the second trigger; no duplicate supplier email sent
E02
Supplier email address missing from reference data
SKU 'TEST-010' at reorder point; Google Sheets reference row has blank supplier_email field
PO Dispatch Agent detects missing email; logs data error with SKU ID; creates Cin7 PO as draft but does not dispatch; internal alert sent
No Gmail send attempted; Cin7 PO status remains Draft; error log includes SKU ID and field name; no Xero bill created
E03
Cin7 API unavailable (timeout or 503 response)
Polling step receives HTTP 503 from Cin7 sandbox with no Retry-After header
Automation platform retries with exponential backoff (30s, 60s, 120s); after three failures, halts and sends internal error alert; no data written
Log shows three retry attempts with correct intervals; error alert payload includes timestamp and HTTP status code; no partial records in any system
E04
Xero API unavailable at bill creation step
PO dispatched to supplier successfully; subsequent Xero API call returns 503
Agent retries Xero bill creation twice; if both fail, logs failure with PO ID; posts internal Slack alert to operations channel; PO dispatch is not rolled back
Supplier email confirmed sent; Xero demo contains no orphaned bill; internal Slack alert received with PO ID and error details; log shows retry count
E05
Slack approval not actioned within 48 hours (manager timeout)
Above-threshold PO Slack message sent; no approve or reject action taken within 48 hours (simulated via timer override)
Automation posts a reminder message to the operations channel at the 24-hour mark; at 48 hours, escalation alert sent; PO remains as draft in Cin7
Reminder Slack message received at 24-hour mark; escalation message at 48-hour mark includes PO ID, value, and SKU; no auto-approval occurs
E06
Negative on-hand stock value in Cin7
Cin7 sandbox SKU 'TEST-011' reports on-hand qty = -5 (negative stock due to oversell)
Reorder Calculation Agent detects negative stock; treats it as a reorder trigger; flags the anomaly in the log; calculates reorder quantity based on reorder point plus safety stock; does not use negative value in calculation
Reorder quantity calculated correctly using reorder point as baseline; anomaly flag present in log with SKU ID and raw stock value; no arithmetic errors
E07
Google Sheets API quota exhausted (429 from Sheets API)
Batch of 10 concurrent PO rows being appended; Sheets API returns 429 with Retry-After: 60
Agent queues remaining append operations; retries after 60 seconds; all rows eventually written with no data loss
Google Sheets test file contains all 10 expected rows after retry cycle completes; no rows lost or duplicated; log shows queue and retry events