FS-DOC-06Quality
Test and QA Plan
Renewal and Contract Expiry Management
[YourCompany.com] · Sales Department · Prepared by FullSpec · [Today's Date]
This document defines the complete testing programme for the Renewal and Contract Expiry Management automation. It covers all three quality phases, from isolated agent unit tests through integration and edge cases to a final end-to-end production run. The FullSpec team executes Phases 1 and 2 entirely in sandbox environments. Your team joins Phase 3 to verify production behaviour and record formal sign-off. No phase begins until all test cases in the previous phase have achieved a passing status.
01Testing approach
Testing runs in three sequential phases. Each phase must reach a full pass before the next phase opens. This prevents integration assumptions being built on top of unverified unit behaviour, and ensures no production credentials or live records are touched until the automation has been validated end to end in safe environments.
1Phase 1: Unit Testing
Each agent tested in isolation against sandbox data
Scope
Individual agent logic: Contract Monitoring Agent, Renewal Outreach Agent, and Approval and Closing Agent. Each tested independently with mocked inputs.
Environment
Sandbox only. HubSpot developer sandbox, Gmail test account, DocuSign demo environment, Xero demo company, and Slack test workspace.
Credential rule
No production credentials may be used. All API keys, OAuth tokens, and webhook URLs must reference sandbox or demo instances exclusively.
Pass condition
All test cases T01 through T15 must return the expected output with zero critical failures. Warnings are documented and assessed before Phase 2 begins.
Who runs it
FullSpec team only. No process owner involvement required at this phase.
2Phase 2: Integration and Edge Case Testing
Agent handoffs and failure scenarios tested across connected tools
Scope
Cross-agent handoffs, data passing between HubSpot, Gmail, Slack, DocuSign, and Xero, plus structured edge cases covering duplicates, missing data, tool unavailability, and human timeout scenarios.
Environment
Sandbox only. Same sandbox instances as Phase 1, with multi-agent orchestration layer enabled and agent-to-agent triggers active.
Credential rule
No production credentials. All tool connections remain pointed at sandbox or demo instances. Credential configuration must be verified before each integration test run.
Pass condition
All integration test cases T16 through T22 pass, and all edge cases E01 through E06 resolve to their defined expected outcomes. No unhandled exceptions permitted.
Who runs it
FullSpec team only. Results are shared with the process owner as a summary before Phase 3 is scheduled.
3Phase 3: End-to-End Production Test
Full production run verified by FullSpec and the process owner
Scope
A complete, real-data run through the entire automation from the daily HubSpot scan through to a signed DocuSign contract and a raised Xero invoice, using live production credentials against a designated internal test record.
Environment
Production. Live HubSpot instance, live Gmail accounts, live DocuSign account, live Slack workspace, and live Xero company. Test record must be clearly marked internal and voided after the run.
Credential rule
Production credentials in use. All account manager Gmail OAuth tokens must be confirmed active. HubSpot private app token, DocuSign integration key, Slack bot token, and Xero OAuth 2.0 token must be verified against production scopes before the run begins.
Pass condition
All test cases T23 through T27 pass, including the process owner review and approval recorded as T27. No unhandled errors in production logs.
Who runs it
FullSpec team runs T23 through T26. The process owner participates in T27 to review outputs, confirm accuracy, and record formal approval in the FullSpec confirmation system.
Test and QA PlanPage 1 of 4
FS-DOC-06Quality
02Phase 1 — unit test cases
Sandbox credentials only during Phase 1. No test in this phase may reference a production HubSpot instance, live Gmail account, active DocuSign envelope, production Slack workspace, or live Xero company. If a credential check returns a production URL or token, halt the test run and rotate credentials before continuing.
Contract Monitoring Agent — Unit Tests
ID
Scenario
Input
Expected Output
Pass Criteria
T01
Happy path: contract within 90-day window, no prior activity
HubSpot sandbox deal with expiry date 85 days from today; no logged activity on the deal
Deal added to the outreach queue; ranked entry written to Google Sheets sandbox tab; HubSpot deal field 'Renewal Status' set to 'Queued'
Queue entry present; Google Sheets row created with correct deal ID, days remaining, and deal value; HubSpot field updated within 60 seconds of trigger
T02
Contract outside 90-day window — should not be flagged
HubSpot sandbox deal with expiry date 120 days from today
Deal not added to the outreach queue; no Google Sheets row created; no HubSpot field update
Queue remains unchanged; no new Sheets row; HubSpot deal record unmodified
T03
Contract within 90-day window with existing renewal activity logged
HubSpot sandbox deal expiring in 75 days; CRM activity 'Renewal email sent' logged 3 days ago
Deal not re-added to the queue; existing entry updated with latest activity timestamp if already queued
No duplicate queue entry created; agent log confirms activity detected and record skipped or updated correctly
T04
Prioritisation: two contracts, one higher deal value and fewer days remaining
Deal A: $12,000 value, 28 days remaining. Deal B: $4,000 value, 55 days remaining
Deal A ranked above Deal B in the Google Sheets output and in the HubSpot queue view
Google Sheets row order reflects correct priority; ranking field on each HubSpot deal record matches expected rank
T05
HubSpot API timeout during deal fetch
Simulated 30-second API timeout on the HubSpot deals endpoint (mock error code 504)
Agent logs a timeout error; execution pauses; retry attempted after 60 seconds; alert written to error log
Error log entry created with timestamp and deal ID; retry attempt confirmed in execution trace; no silent failure
T06
Expiry date field missing from HubSpot deal record
HubSpot sandbox deal with no value in the contract expiry date property
Deal skipped from queue; exception logged with deal ID and field name; no Google Sheets row written
Exception log entry present; Sheets tab unmodified for this record; agent continues processing remaining deals without halting
Renewal Outreach Agent — Unit Tests
ID
Scenario
Input
Expected Output
Pass Criteria
T07
Happy path: 90-day outreach email sent to a queued contract
Contract Monitoring Agent output with a valid deal record; assigned account manager Gmail sandbox account connected
Personalised renewal email sent from account manager's sandbox Gmail; HubSpot activity 'Renewal email sent — 90 day' logged on deal; deal field 'Outreach Stage' set to '90-day'
Email appears in Gmail sandbox sent folder; HubSpot activity record created with correct timestamp; deal stage field updated
T08
60-day follow-up triggered after no client reply detected
Deal in queue with '90-day' outreach stage; no inbound reply detected in Gmail sandbox within the configured window
60-day follow-up email sent; HubSpot activity logged; deal field updated to '60-day' outreach stage
Second email in Gmail sandbox sent folder; HubSpot activity created; stage field shows '60-day'
T09
Outreach sequence paused when client reply detected
Deal at '60-day' stage; inbound reply email present in Gmail sandbox from the client contact address
Sequence paused; no 30-day email queued; HubSpot deal field 'Reply Received' set to true; activity logged
No further outreach emails queued; HubSpot flag set; activity record confirms pause reason as 'reply detected'
T10
Gmail OAuth token expired during send attempt
Valid deal in queue; account manager Gmail OAuth token set to expired state in sandbox
Send fails gracefully; error logged with account manager name and deal ID; Slack sandbox notification sent to account manager flagging credential issue
No email sent; error log entry present; Slack sandbox message visible in the designated test channel
T11
Template merge field missing: client contact name absent from HubSpot deal
Deal record in queue with no value in the primary contact first name field
Email not sent; exception logged; fallback salutation 'Dear Valued Client' used if fallback mode is enabled, or send blocked and error raised if strict mode is configured
Agent log confirms field missing; chosen mode behaviour executed correctly; no malformed email sent with empty merge tags
Approval and Closing Agent — Unit Tests
ID
Scenario
Input
Expected Output
Pass Criteria
T12
Happy path: Slack approval request sent and approved
Account manager marks deal 'Ready for Approval' in HubSpot sandbox; Slack sandbox workspace connected; sales manager user present in Slack test channel
Structured Slack message sent to designated approver with deal summary and approve/decline buttons; on approval click, status updates to 'Approved' in HubSpot
Slack message visible in test channel with correct deal details; button interaction recorded; HubSpot deal status field updated within 30 seconds of click
T13
Slack approval declined by sales manager
Approval request sent in Slack sandbox; sales manager clicks 'Decline'
HubSpot deal status set to 'Approval Declined'; account manager receives Slack notification with decline reason field; DocuSign step not triggered
HubSpot field updated; account manager Slack DM sent; no DocuSign envelope initiated in demo environment
T14
DocuSign contract generated and sent after approval
Deal approved in HubSpot sandbox; DocuSign demo environment connected with a pre-configured renewal template
DocuSign envelope created from the renewal template pre-filled with client name, deal value, and new contract dates; envelope sent to client contact email in demo mode
DocuSign demo dashboard shows new envelope with correct recipient and pre-filled fields; HubSpot deal field 'DocuSign Status' set to 'Sent'
T15
Post-signature write-back: HubSpot deal updated and Xero invoice raised
DocuSign demo webhook fires a 'completed' event with signed envelope data; Xero demo company connected with a standard renewal service line item configured
HubSpot deal stage moved to 'Renewed'; new contract start and end dates written to deal fields; Xero demo invoice created with correct amount and renewal period; invoice status 'Draft' or 'Awaiting Approval' depending on configured Xero workflow
HubSpot deal record shows updated stage and date fields; Xero demo company shows new invoice with correct line item, amount, and client name; no duplicate invoice created
Test and QA PlanPage 2 of 4
FS-DOC-06Quality
03Phase 2 — integration and edge case tests
Integration Tests — Agent Handoffs
Phase 2 tests the full data pipeline across all three agents operating together. All tests remain in sandbox environments. The orchestration layer must be running with multi-agent triggers active before any Phase 2 test is executed.
ID
Scenario
Input
Expected Output
Pass Criteria
T16
Contract Monitoring Agent output triggers Renewal Outreach Agent correctly
Contract Monitoring Agent completes a sandbox scan and writes three contracts to the outreach queue in HubSpot and Google Sheets
Renewal Outreach Agent is triggered automatically for each queued contract; three 90-day emails sent from Gmail sandbox; three HubSpot activity records created
All three emails present in Gmail sandbox sent folder; all three HubSpot activity records created; no contracts skipped; trigger latency under 90 seconds
T17
Renewal Outreach Agent reply detection triggers Approval and Closing Agent readiness flag
Client reply detected in Gmail sandbox for a deal at '60-day' stage; account manager marks deal 'Ready for Approval' in HubSpot
Approval and Closing Agent receives the trigger; Slack approval request sent to sales manager sandbox user
Slack message sent within 60 seconds of HubSpot field update; deal ID and summary in Slack message match the HubSpot record exactly
T18
Full three-agent handoff chain: scan to email to approval to contract to invoice
A single sandbox deal moves through all automated steps in sequence: flagged by monitoring, emailed, replied to, approved, DocuSign sent, signed webhook fired, HubSpot and Xero updated
Each step produces its defined output; no step is skipped; all tool records (HubSpot, Gmail, Slack, DocuSign, Xero) reflect the correct state at the end of the chain
All seven tool state checks pass; agent execution log shows no errors; end-to-end chain completes within the defined timeout window of 10 minutes excluding human approval wait time
T19
Google Sheets write-back from Contract Monitoring Agent is consistent with HubSpot queue
Contract Monitoring Agent processes eight sandbox deals of varying expiry dates and values
Google Sheets sandbox tab contains exactly the same records as the HubSpot outreach queue, with matching deal IDs, rankings, and days-remaining values
Row count matches between Sheets and HubSpot queue; no field value discrepancy across all eight records; duplicate rows absent
T20
DocuSign webhook payload correctly updates HubSpot and Xero in Approval and Closing Agent
DocuSign demo fires a 'completed' webhook with a signed envelope containing updated contract start date, end date, and deal value
HubSpot deal fields updated with correct dates from the webhook payload; Xero invoice amount matches the deal value in the webhook; no hardcoded values used
HubSpot field values match webhook payload exactly; Xero invoice amount matches; webhook processing logged with envelope ID
T21
Slack approval timeout: no response from sales manager within configured window
Approval request sent in Slack sandbox; sales manager does not interact with the message within the configured timeout period (default: 48 hours, simulated in sandbox)
Reminder Slack message sent to sales manager; if second timeout reached, escalation message sent to Head of Sales sandbox user; deal status set to 'Approval Pending — Escalated'
Reminder message sent at correct interval; escalation message sent to second approver; HubSpot deal status updated; no DocuSign envelope created during the timeout window
T22
Non-standard terms branch: deal routed to manual proposal step instead of automated DocuSign
Deal flagged in HubSpot with custom field 'Non-Standard Terms' set to true; account manager approval trigger fires
Approval and Closing Agent routes the deal to the manual proposal step; Slack notification sent to account manager with instruction to prepare a custom proposal; DocuSign envelope not created
No DocuSign envelope initiated; Slack message sent to account manager with correct deal reference; HubSpot deal field 'Proposal Type' set to 'Manual'
Edge Case Tests
ID
Scenario
Input
Expected Output
Pass Criteria
E01
Duplicate contract record in HubSpot: same client and expiry date on two deal records
Two HubSpot sandbox deals with identical client contact ID and identical expiry date, both within the 90-day window
Contract Monitoring Agent detects the duplicate; only one deal is queued; a deduplication warning is logged with both deal IDs; no duplicate outreach emails sent
Queue contains exactly one entry for the client; warning log entry present with both deal IDs; single Gmail email in sandbox sent folder for that contact
E02
Missing client contact email on HubSpot deal record
Deal within 90-day window; associated contact record has no email address field populated
Renewal Outreach Agent skips the deal; exception logged with deal ID and missing field; account manager notified via Slack sandbox with the deal name and instruction to add contact email
No email send attempted; exception log entry present; Slack notification sent to account manager; deal remains in queue with status 'Blocked — Missing Email'
E03
Xero API unavailable during post-signature invoice creation
DocuSign demo webhook fires 'completed'; Xero API returns a 503 error on the invoice creation request
HubSpot deal updated successfully (those writes do not depend on Xero); Xero invoice creation queued for retry; error logged with envelope ID and timestamp; account manager notified via Slack that invoice creation is pending
HubSpot write confirms success; Xero retry queue entry present; error log contains 503 response details; Slack notification sent; invoice created successfully on retry once Xero is available
E04
Gmail send rate limit reached during a bulk outreach run
Contract Monitoring Agent flags 25 contracts simultaneously; Renewal Outreach Agent attempts to send all 25 emails in rapid succession; Gmail API returns a 429 rate limit response
Outreach Agent respects the rate limit; sends are queued and spaced according to the configured send interval (default: one email per 2 seconds); all 25 emails eventually sent; no emails dropped
All 25 emails present in Gmail sandbox sent folder; send timestamps show correct spacing; no 429 errors appear as unhandled in the agent log; execution completes without manual intervention
E05
Human timeout on manual proposal step: account manager does not prepare custom proposal within 5 business days
Deal routed to manual proposal step; no HubSpot update or Slack response from account manager within the configured 5-business-day window
Escalation Slack message sent to Head of Sales with deal name, client, and days remaining to expiry; deal status updated to 'Manual Proposal Overdue'; no automated DocuSign action taken
Escalation message sent with correct recipient and deal details; HubSpot deal status field updated; original Slack notification to account manager confirmed as sent in earlier step; no DocuSign envelope created
E06
DocuSign template merge fails due to a missing contract value field on the HubSpot deal
Approval granted in Slack; Approval and Closing Agent attempts to generate DocuSign envelope; HubSpot deal record has no value in the 'Renewal Contract Value' field
DocuSign envelope creation blocked; error logged with deal ID and missing field name; account manager notified via Slack to populate the field and re-trigger approval; HubSpot deal status set to 'DocuSign Blocked — Missing Value'
No DocuSign envelope initiated; error log entry present; Slack notification sent to account manager with correct deal reference and field name; HubSpot status field updated correctly
Test and QA PlanPage 3 of 4
FS-DOC-06Quality
04Phase 3 — end-to-end production test
Important before running Phase 3: Use a designated internal test record only. Create a HubSpot deal record clearly named 'INTERNAL TEST — DO NOT CONTACT' with a test contact address that routes to a controlled inbox. Ensure the Gmail account used is the account manager's live account but sending to this internal test address. The DocuSign envelope must be sent to an internal signatory, not a real client. The Xero invoice raised must be voided immediately after the test is confirmed. Confirm all these safeguards are in place before executing T23. Do not proceed if any production client contact address is associated with the test deal record.
All production credentials must be verified before Phase 3 begins: HubSpot private app token (scopes: crm.objects.deals.read, crm.objects.deals.write, crm.objects.contacts.read, crm.schemas.deals.read), Gmail OAuth 2.0 (scopes: gmail.send, gmail.readonly), DocuSign integration key with JWT grant (scopes: signature, impersonation), Slack bot token (scopes: chat:write, chat:write.public, users:read), Xero OAuth 2.0 (scopes: accounting.transactions, accounting.contacts.read). Confirm each token is non-expired and scoped correctly before the test run begins.
ID
Scenario
Input
Expected Output
Pass Criteria
T23
Production daily scan identifies the internal test deal and adds it to the outreach queue
Internal test HubSpot deal record with expiry date set to 82 days from today; no prior renewal activity logged; automation platform running on live production schedule
Test deal appears in the HubSpot outreach queue; ranked entry written to the production Google Sheet; HubSpot deal field 'Renewal Status' updated to 'Queued'; execution log entry timestamped within the 8am run window
Deal present in queue with correct days-remaining value; Google Sheets production tab contains the test deal row; HubSpot field confirmed updated; log entry present with correct deal ID and run timestamp
T24
Production 90-day outreach email sent from live account manager Gmail to internal test address
Test deal queued; Renewal Outreach Agent triggered in production; account manager Gmail OAuth token live and active
Personalised renewal email sent from the account manager's live Gmail address to the internal test inbox; email content contains correct client name (internal test contact), contract expiry date, and account manager signature; HubSpot activity record created
Email visible in account manager Gmail sent folder; internal test inbox receives the email with correct merge fields populated and no empty placeholders; HubSpot activity record present with timestamp and deal ID; outreach stage field set to '90-day'
T25
Slack approval request sent to production sales manager and approved; DocuSign envelope generated and sent to internal signatory
Account manager marks test deal 'Ready for Approval' in live HubSpot; Approval and Closing Agent triggers in production; live Slack workspace connected; DocuSign account live with renewal template configured
Structured Slack message appears in the designated production approval channel with correct deal summary and approve/decline buttons; sales manager approves; DocuSign envelope generated from the renewal template with correct pre-filled fields; envelope sent to internal test signatory email address
Slack message visible in production channel with correct deal name and value; approval interaction recorded; DocuSign account shows new envelope with correct recipient, pre-filled contract dates and value; HubSpot field 'DocuSign Status' set to 'Sent'
T26
DocuSign signed webhook updates HubSpot deal to Renewed stage and raises Xero invoice; invoice immediately voided after confirmation
Internal test signatory signs the DocuSign envelope in the production account; DocuSign fires the 'completed' webhook to the automation platform's production webhook endpoint
HubSpot deal stage updated to 'Renewed'; new contract start and end dates written to deal fields from the webhook payload; Xero invoice created in production with correct amount and renewal period; automation platform execution log confirms webhook receipt and all write operations successful; Xero invoice voided by the FullSpec team immediately after confirmation
HubSpot deal record shows 'Renewed' stage and correct date fields; Xero invoice created with correct line item and amount before voiding; webhook receipt confirmed in execution log with envelope ID and timestamp; no errors in production log for this run; voided Xero invoice confirmed in Xero audit trail
T27
Process owner review and approval: full production run output reviewed against expected behaviour; formal sign-off recorded in FullSpec confirmation system
FullSpec team presents the complete production run log and all tool state outputs (HubSpot deal record, Gmail sent email, Slack approval thread, DocuSign signed envelope, Xero voided invoice) to the process owner for review
Process owner confirms all outputs match expected behaviour across all five tools; confirms no client data was affected; records formal approval in the FullSpec confirmation system; automation cleared for go-live
PASS: FullSpec confirmation system records the process owner's approval with timestamp, reviewer name, and a reference to this test case ID T27. No separate sign-off block is required. Go-live may proceed.
Once T27 is recorded as passed in the FullSpec confirmation system, the automation is cleared for live operation. The manual renewal process may be switched off, and the parallel run period defined in the Launch Plan may begin. Any issues discovered after go-live should be reported to support@gofullspec.com with the relevant execution log reference and deal ID.
Test and QA PlanPage 4 of 4