Back to Invoice Generation & Delivery

Test and QA Plan

How the build is validated before go-live: three sequential test phases, edge cases, and production verification.

4 pagesPDF · Quality
FS-DOC-06Quality

Test and QA Plan

Invoice Generation and Delivery

[YourCompany.com] · Finance Department · Prepared by FullSpec · [Today's Date]

This document defines the complete test and quality-assurance programme for the Invoice Generation and Delivery automation. It covers three sequential phases: unit tests for each agent in isolation, integration and edge-case tests for agent handoffs and failure modes, and a final end-to-end production run with process owner sign-off. The FullSpec team runs all three phases; the process owner joins Phase 3. No phase begins until the previous phase has fully passed. All 24 test cases are numbered sequentially so every result can be traced to a specific scenario.

01Testing approach

Testing proceeds through three phases in strict sequence. No phase begins until every test case in the previous phase reaches a Pass status. This gate keeps defects isolated to the layer where they originate and prevents integration noise from masking unit-level failures. The FullSpec team owns execution for all phases; the process owner (Finance Lead) joins Phase 3 to confirm the production run and provide formal approval.

1
Phase 1: Unit Testing
Each agent tested in isolation against sandbox data
Scope
Invoice Builder Agent and Delivery and CRM Sync Agent tested independently; no cross-agent calls
Environment
Sandbox only — Xero demo company, HubSpot sandbox portal, Gmail test account, Sheets staging workbook, Slack test workspace
Credential rule
No production credentials permitted; all sandbox keys stored in the test credential vault only
Pass condition
All cases T01 through T14 return the expected output with zero data-mapping errors
Who runs it
FullSpec team only
2
Phase 2: Integration and Edge Case Testing
Agent handoffs and failure-mode scenarios validated end to end in sandbox
Scope
Cross-agent handoff from Invoice Builder Agent to Delivery and CRM Sync Agent; edge cases including duplicates, missing data, tool unavailability, and human timeout
Environment
Sandbox only — same sandbox stack as Phase 1; no production data introduced
Credential rule
Sandbox credentials only; failure injection performed via mock error responses rather than live tool outages
Pass condition
All cases T15 through T19 pass and all edge-case cases E01 through E05 return the correct error-handling or fallback behaviour
Who runs it
FullSpec team only
3
Phase 3: End-to-End Production Test
Full production run traced from HubSpot trigger to Slack confirmation
Scope
Complete workflow executed against the live production environment using an internal test deal record; all five downstream systems verified
Environment
Production — live HubSpot portal, live Xero organisation, live Gmail sender, live Google Sheets log, live Slack channel
Credential rule
Production credentials used; test deal record must be voided and removed from live data after the run is complete
Pass condition
All cases T20 through T24 pass; Finance Lead (process owner) formally approves the result and sign-off is recorded in the FullSpec confirmation
Who runs it
FullSpec team executes; process owner (Finance Lead) joins to review the draft invoice, approve it, and confirm all downstream outputs
Test and QA PlanPage 1 of 4
FS-DOC-06Quality

02Phase 1 — unit test cases

Sandbox credentials only. Before running any Phase 1 case, confirm that all tool connections point to the sandbox environment. Do not use a live Xero organisation, production HubSpot portal, or real Gmail sender at this stage. Any test case that inadvertently touches a production system must be halted, logged, and re-run in sandbox before the result is recorded.

Invoice Builder Agent — reads a HubSpot deal record, maps fields to Xero invoice fields, applies tax code and payment terms, and creates a draft invoice. Estimated build time: 14 hours. Complexity: Moderate.

ID
Scenario
Input
Expected output
Pass criteria
T01
Happy path: standard deal triggers draft invoice
HubSpot deal moved to Closed-Won; deal contains client name, one line item, amount $2,500, Net 30 terms, GST tax code
Draft invoice created in Xero sandbox with correct client, line item, amount, due date 30 days out, and GST applied
Xero invoice ID returned; all five fields match deal data exactly; draft status confirmed
T02
Multi-line-item deal
HubSpot deal with three line items totalling $7,800; Net 14 terms; Tax Exempt client
Draft invoice in Xero with three discrete line items, correct subtotals, zero tax, due date 14 days out
Line item count equals three; total equals $7,800; tax amount equals $0; due date correct
T03
Payment terms mapping: Net 60 client tier
HubSpot deal tagged with client tier Enterprise; amount $12,000
Draft invoice due date set 60 days from invoice date in Xero
Due date offset equals 60 days; no other field altered
T04
Tax code mapping: standard rate (20%)
HubSpot deal with client jurisdiction flagged as standard VAT; amount $5,000
Xero draft invoice shows tax amount of $1,000 (20% of $5,000) on the line item
Tax amount field equals $1,000; tax code equals standard rate code in Xero sandbox
T05
HubSpot deal missing billing contact email
HubSpot deal moved to Closed-Won; associated company contact has no email address on record
Agent halts invoice creation; error event logged; Slack alert sent to finance channel with deal ID and fault description
No Xero invoice created; error log entry present; Slack message delivered within 60 seconds
T06
Zero-value line item in deal
HubSpot deal contains one line item at $0 (complimentary service) plus one at $1,200
Draft invoice created with both line items; zero-value line item included; total equals $1,200
Line item count equals two; $0 line present; total correct; Xero draft status confirmed
T07
Xero contact does not exist for the deal company
HubSpot deal company domain has no matching Xero contact record in sandbox
Agent attempts contact lookup; on failure, creates a new Xero contact from HubSpot company data and then creates the draft invoice
New Xero contact created with correct name and email; draft invoice linked to new contact; no duplicate contact created on re-run
T08
Duplicate deal stage change event fired twice
HubSpot webhook fires the Closed-Won event twice within 10 seconds for the same deal ID
Only one draft invoice created in Xero; second event deduplicated by the automation platform using deal ID as idempotency key
Xero invoice count for the deal equals one; second run produces a deduplication log entry rather than a second invoice

Delivery and CRM Sync Agent — listens for Xero invoice status change from Draft to Approved, then sends the invoice via Gmail, updates HubSpot, appends the Google Sheets log row, and posts a Slack confirmation. Estimated build time: 14 hours. Complexity: Moderate.

ID
Scenario
Input
Expected output
Pass criteria
T09
Happy path: approved invoice triggers full delivery chain
Xero sandbox invoice status changed from Draft to Approved; invoice $3,200, client email test@sandbox.internal
Gmail sends branded email with PDF attachment; HubSpot deal moved to Invoiced stage with Xero reference written back; Sheets row appended; Slack message posted
All four downstream actions confirmed; Gmail delivery receipt logged; HubSpot deal stage equals Invoiced; Sheets row count incremented by one; Slack message visible in test channel
T10
Gmail email delivered with correct PDF attachment
Approved Xero invoice for sandbox client; invoice total $900
Gmail sends email to test address with invoice PDF attached and branded template body
Email received at test inbox; attachment is a valid PDF; file name matches invoice number; body contains payment link placeholder
T11
HubSpot deal stage update and reference write-back
Approved Xero invoice with reference INV-0042; linked HubSpot deal ID present
HubSpot deal stage property set to Invoiced; custom field Xero Invoice Reference equals INV-0042
HubSpot API GET on deal confirms stage equals Invoiced and reference field equals INV-0042
T12
Google Sheets row appended correctly
Approved invoice: client Acme Corp, INV-0043, $4,500, send date today, due date Net 30
New row appended to staging Sheets log with columns: Invoice Number, Client Name, Amount, Send Date, Due Date
Row exists in correct tab; all five columns populated with matching values; no existing rows overwritten
T13
Slack confirmation message posted
Approved invoice for client Beta Ltd, $1,750, Xero link available
Slack message posted to #finance-test channel containing client name, amount, and Xero invoice URL
Message appears in correct channel within 30 seconds; all three data fields present; link is a valid Xero URL format
T14
HubSpot deal ID not found at delivery time
Xero invoice approved but the deal ID stored in the invoice custom field has been deleted from HubSpot
Agent logs error; Slack alert sent to finance channel with invoice number and fault; Gmail send still completes; Sheets row still appended
Gmail and Sheets steps succeed; HubSpot step skipped with error log entry; Slack alert delivered; no unhandled exception
Test and QA PlanPage 2 of 4
FS-DOC-06Quality

03Phase 2 — integration and edge case tests

Phase 2 validates the handoff between the Invoice Builder Agent and the Delivery and CRM Sync Agent, and then stress-tests the full sandbox flow against edge cases that are known failure modes for this process type. All IDs continue the T sequence from Phase 1.

ID
Scenario
Input
Expected output
Pass criteria
T15
Full sandbox run: trigger through to Slack confirmation
HubSpot sandbox deal moved to Closed-Won; Finance Lead approves draft in Xero sandbox; all five tools connected
Invoice Builder Agent creates draft; Finance Lead approves; Delivery and CRM Sync Agent completes all four delivery steps in sequence
All nine workflow nodes reached; no step skipped; end-to-end elapsed time under five minutes from trigger to Slack post
T16
Finance Lead rejects draft and re-approves after correction
Finance Lead declines the Xero draft, edits one line item amount, then approves the corrected version
Delivery agent triggers only on the second Approved status event; delivers corrected invoice; no email sent for the first draft
Gmail sends exactly one email; the amount in the email matches the corrected figure; HubSpot reference and Sheets row reflect corrected invoice
T17
Xero API rate limit hit during invoice creation
Simulate Xero returning HTTP 429 Too Many Requests on the first create attempt
Automation platform retries after exponential back-off (30 s, 60 s, 120 s); invoice created on retry; no duplicate invoice
Invoice created on retry attempt; retry count logged; only one Xero invoice exists for the deal; Finance Lead notified of delay via Slack
T18
Google Sheets API unavailable during log append
Mock Sheets returning HTTP 503 for 90 seconds during the delivery run
Agent retries Sheets append; on continued failure logs the row data to the error queue for manual recovery; all other delivery steps (Gmail, HubSpot, Slack) complete successfully
Gmail, HubSpot, and Slack steps confirmed complete; Sheets error logged with row payload; Slack alert sent to finance channel
T19
Invoice Builder Agent produces draft; Delivery agent loses Xero webhook event
Xero Approved event webhook dropped in transit (simulate by disabling webhook endpoint for 5 minutes after approval)
System detects missing event via polling fallback; Delivery agent triggers within 10 minutes of approval; no double send
Delivery chain completes; elapsed time from approval to Gmail send under 10 minutes; no duplicate email sent; polling fallback log entry present

Edge case tests are run immediately after T15 through T19 while the sandbox environment remains configured. Each case targets a known failure mode specific to this process.

ID
Scenario
Input
Expected output
Pass criteria
E01
Duplicate HubSpot deal stage change for already-invoiced deal
Deal already has a Xero invoice reference in HubSpot; stage change fires again to Closed-Won
Automation detects existing invoice reference; skips invoice creation; logs deduplication event; Slack alert sent to finance channel
No second Xero invoice created; deduplication log entry present; Slack alert includes deal ID and existing invoice reference
E02
Missing or null amount on deal line item
HubSpot deal moved to Closed-Won; one line item has a null amount field
Invoice Builder Agent halts; validation error logged with field name and deal ID; Finance Lead alerted via Slack; no Xero draft created
Xero invoice count for deal equals zero; error log entry identifies null amount field; Slack alert delivered within 60 seconds
E03
Client billing email bounces
Gmail receives a permanent delivery failure (SMTP 550) for the invoice email
Bounce event captured; error logged with client name and invoice number; Slack alert posted to finance channel; HubSpot deal tagged with Delivery Failed flag
Gmail bounce logged; HubSpot deal has Delivery Failed tag; Slack alert contains client name, invoice number, and bounce reason
E04
Finance Lead does not approve or reject the draft within 48 hours
Draft invoice sits in Xero with no status change for 48 hours
Automation sends a reminder Slack message to the Finance Lead with the Xero draft link; reminder repeats at 72 hours; no invoice sent without approval
First Slack reminder sent at the 48-hour mark; second reminder at 72 hours; no Gmail invoice email sent; audit log shows both reminder events
E05
Payment terms not found in the mapping table for this client tier
HubSpot deal has a client tier value that has no matching row in the payment terms mapping table in Google Sheets
Invoice Builder Agent halts field mapping at the payment terms step; error logged with client tier value and deal ID; Finance Lead alerted via Slack to update the mapping table before re-running
No Xero draft created; error log identifies missing mapping row; Slack alert includes client tier value and deal ID; workflow can be re-triggered after the mapping table is updated
Test and QA PlanPage 3 of 4
FS-DOC-06Quality

04Phase 3 — end-to-end production test

Important before running Phase 3: Use an internal test email address (not a real client address) as the billing contact on the test deal. The Finance Lead must void the test invoice in Xero immediately after sign-off and delete the test row from the Google Sheets log. The HubSpot test deal should be moved to a holding stage and clearly labelled TEST so it does not appear in live pipeline reporting. Do not proceed if any of these pre-conditions cannot be met. Contact support@gofullspec.com if you need assistance setting up the test deal record.

Phase 3 runs a single, fully traced production workflow from the HubSpot trigger through to the Slack confirmation. The FullSpec team executes the run with the Finance Lead present. All five production systems are touched. The final test case in this phase is the process owner review-and-approval; that approval is the formal go-live gate and is recorded in the FullSpec confirmation document rather than in a separate sign-off block.

ID
Scenario
Input
Expected output
Pass criteria
T20
Production trigger: HubSpot deal moved to Closed-Won
Live HubSpot deal for internal test company; deal amount $1.00; billing contact set to internal test email address; payment terms Net 30; standard tax code
Automation platform receives the HubSpot webhook event within 30 seconds of stage change; Invoice Builder Agent begins execution
Webhook receipt timestamp logged; deal ID confirmed in execution log; no errors at trigger stage
T21
Production Xero draft invoice created correctly
Deal data fetched from live HubSpot; mapped to live Xero organisation
Draft invoice appears in live Xero with correct client name, $1.00 line item, Net 30 due date, correct tax code, and deal ID stored in the invoice reference field
Finance Lead confirms draft visible in Xero; all five field values verified against the HubSpot deal record; draft status confirmed before approval
T22
Production Gmail delivery to internal test address
Finance Lead approves the draft in live Xero; Delivery and CRM Sync Agent fires
Gmail sends branded invoice email with PDF attachment to the internal test address within two minutes of approval
Email received at internal test inbox; PDF attachment opens correctly; email body contains correct client name, amount, and payment link; no real client address copied
T23
Production downstream updates verified across HubSpot, Sheets, and Slack
Gmail send completes; agent continues to remaining three steps
HubSpot deal stage updated to Invoiced with Xero reference written back; Google Sheets log receives new row with correct five columns; Slack #finance channel receives confirmation message with client name, amount, and Xero link
HubSpot API GET confirms deal stage and reference field; Sheets row verified by Finance Lead in live workbook; Slack message visible to Finance Lead within 30 seconds of Gmail send
T24
Error log verification and process owner review-and-approval
Full production run complete; Finance Lead reviews all outputs across all five systems
No unhandled errors in the execution log; all four delivery outputs confirmed accurate; Finance Lead is satisfied that the workflow matches the agreed process and the human review step functions as designed
Execution log shows zero unhandled exceptions; Finance Lead verbally confirms all outputs match expectations; approval is recorded by the FullSpec team in the FullSpec confirmation document; test invoice voided in Xero and test row removed from Sheets before the session closes
Once T24 is recorded as Pass and the process owner approval is confirmed, the FullSpec team marks the automation as go-live ready. The test deal, test invoice, and test Sheets row must all be cleaned up before the live environment is handed over. If T24 does not pass in the first production run, the FullSpec team will diagnose, resolve, and re-run from T20 before approval is requested again. Contact support@gofullspec.com to schedule the Phase 3 session.
Test and QA PlanPage 4 of 4

More documents for this process

Every document generated for Invoice Generation & Delivery.

Launch Plan
Operations · Owner
View
ROI and Business Case
Finance · Owner
View
Process Runbook / SOP
Operations · Owner
View
Developer Handover Pack
Technical · Developer
View
Integration and API Spec
Technical · Developer
View