Back to Contract Generation & Management

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

Contract Generation and Management

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

This document defines the complete testing programme for the Contract Generation and Management automation, covering the Contract Drafting Agent and the Signature and Filing Agent. It is written for the FullSpec team executing the build and for the process owner who joins testing in Phase 3. Testing runs in three strict phases: Unit, Integration, and End-to-end. No phase begins until every test case in the previous phase carries a confirmed pass. All test results are logged in the FullSpec confirmation record and retained for audit purposes.

01Testing approach

Testing is structured into three phases that run in strict sequence. Phase 1 validates each agent in isolation against sandbox credentials. Phase 2 validates agent handoffs, tool integrations, and edge-case resilience. Phase 3 runs a full production end-to-end trace with the process owner present. No phase begins until the previous phase fully passes, meaning zero open failures and all conditional paths confirmed.

1
Phase 1: Unit Testing
Estimated duration: 1 to 2 build days
Scope
Each agent tested individually: Contract Drafting Agent (T01 to T08) and Signature and Filing Agent (T09 to T16). No cross-agent calls; stub outputs used where needed.
Environment
Sandbox only. HubSpot sandbox account, DocuSign developer sandbox, Google Drive test folder, Gmail test inbox, Xero demo company, Notion test workspace.
Credential rule
No production credentials permitted in Phase 1. All API keys, OAuth tokens, and webhook URLs must point to sandbox or developer environments. Credentials are stored in the automation platform's encrypted credential vault under sandbox-prefixed entries.
Pass condition
All test cases T01 to T16 return the expected output with no unhandled errors. Every failure mode routes to the correct error branch. Phase 2 does not begin until this condition is met.
Who runs it
FullSpec team only. Process owner is not required for Phase 1.
2
Phase 2: Integration and Edge Case Testing
Estimated duration: 1 to 2 build days
Scope
Agent-to-agent handoffs, cross-tool data consistency, and edge cases including duplicate deals, missing HubSpot fields, tool unavailability, and manager approval timeout. Integration IDs continue from T17; edge cases use E01 onwards.
Environment
Sandbox for all tool connections. Cross-tool data written and read within the same sandbox session to verify mapping fidelity end to end without touching production records.
Credential rule
Sandbox credentials remain in use. No production OAuth tokens, no live DocuSign envelopes, no real Xero invoices. Any test that requires a webhook must use a sandbox webhook URL.
Pass condition
All integration cases T17 to T24 pass and all edge cases E01 to E08 route to the correct fallback or error handler. No silent failures. Phase 3 does not begin until this condition is met.
Who runs it
FullSpec team only. Process owner is not required for Phase 2.
3
Phase 3: End-to-End Production Test
Estimated duration: 1 build day plus process owner sign-off
Scope
Full production run traced from HubSpot deal trigger through to executed contract in Google Drive, CRM status update, and Xero invoice creation. Covers T25 to T29, including the process owner review and approval case.
Environment
Live production environment. Real credentials, real tool accounts. An internal test deal record and an internal test email address are used. All test records are voided after the run.
Credential rule
Production credentials active. DocuSign envelope must be sent to an internal test address only. The Xero invoice must be marked void immediately after confirmation. The HubSpot deal used for testing must be clearly labelled TEST and deleted or archived after sign-off.
Pass condition
All cases T25 to T29 pass in the production environment with no manual interventions outside the designated approval step. Process owner confirms sign-off is recorded in the FullSpec confirmation log.
Who runs it
FullSpec team leads the run. Process owner joins for T28 (approval gate verification) and T29 (final sign-off).
Test and QA PlanPage 1 of 4
FS-DOC-06Quality

02Phase 1 — unit test cases

Sandbox credentials only. Before running any Phase 1 test, confirm that all tool connections in the automation platform point to sandbox or developer environments. Do not use production API keys, live HubSpot deals, real DocuSign envelopes, or live Xero accounts at this stage. Any credential found pointing to production must be rotated before testing proceeds.

Contract Drafting Agent (trigger: HubSpot deal stage moves to Closed Won; outputs: populated contract draft saved to Google Drive)

ID
Scenario
Input
Expected Output
Pass Criteria
T01
Happy path: complete deal record, standard service type
HubSpot sandbox deal with all mandatory fields populated (client name, entity type, service type, start date, fee amount, payment terms)
Correct template selected; all variable fields populated accurately; draft saved to Google Drive test folder with correct naming convention
Google Drive file exists; filename matches pattern CLIENT_ContractType_YYYY-MM-DD; all placeholder fields replaced with deal data; no unfilled tokens remain in document
T02
Template selection: multiple service types mapped
Three separate sandbox deals each with a different service type value in HubSpot
Each deal triggers selection of the corresponding contract template from the library; no template mismatch
Template filename in Google Drive matches the service-type-to-template mapping table defined in the field-mapping specification for all three deals
T03
Field population accuracy: special characters and long strings
HubSpot deal with client entity name containing an ampersand and a registered trademark symbol; fee amount with decimal cents
Contract draft renders special characters correctly; fee amount formatted to two decimal places
Rendered document reviewed in Google Drive; no encoding errors; fee field matches HubSpot value exactly
T04
Failure mode: missing mandatory HubSpot field (start date absent)
HubSpot sandbox deal with start date field left blank
Agent halts population; flags the incomplete record; does not save a partial draft; sends an internal alert notification
No draft file created in Google Drive; alert notification delivered to the configured internal Gmail address; error logged in automation platform run history
T05
Failure mode: missing mandatory HubSpot field (fee amount absent)
HubSpot sandbox deal with fee amount field left blank
Agent halts; flags the record; no draft saved; internal alert sent
Same pass criteria as T04; error message text references the specific missing field name
T06
Failure mode: no matching template for service type value
HubSpot sandbox deal with service type set to a value not present in the template library
Agent halts; flags unrecognised service type; does not attempt to use a fallback template; internal alert sent
No draft file created; error log entry includes the unrecognised service type value; alert received in Gmail test inbox
T07
Failure mode: Google Drive write permission denied
Sandbox deal with all fields complete; Google Drive test folder permissions set to read-only for the automation service account
Agent logs a Google Drive write error; does not silently fail; internal alert sent; run marked as failed in automation platform
Run history shows error state; no partial file in Drive; alert received; run does not retry indefinitely (maximum three retries confirmed in logs)
T08
Naming convention enforcement
Sandbox deal with client name containing spaces and mixed case
Google Drive filename normalised to uppercase client name with underscores replacing spaces, matching the agreed naming convention
Filename in Google Drive matches the exact pattern defined in the field-mapping specification; no raw spaces in filename

Signature and Filing Agent (trigger: manager approves contract draft via Gmail approval link; outputs: DocuSign envelope dispatched, executed contract filed, HubSpot updated, Xero invoice drafted)

ID
Scenario
Input
Expected Output
Pass Criteria
T09
Happy path: manager approves via Gmail link
Simulated approval payload from Gmail sandbox; Google Drive draft file present at expected path
DocuSign sandbox envelope created with correct recipient email and signing fields placed per template; envelope dispatched
DocuSign sandbox shows envelope in Sent status; recipient matches HubSpot contact email; signing fields present at predefined positions
T10
Reminder sequence: day-3 reminder fires
DocuSign sandbox envelope in Sent status; simulated time advance to day 3 with no signer action
DocuSign automated reminder email sent to recipient at 72-hour mark
DocuSign sandbox activity log shows reminder event at day 3; no manual intervention required
T11
Reminder sequence: day-5 reminder fires
DocuSign sandbox envelope in Sent status; simulated time advance to day 5 with no signer action
Second DocuSign reminder email sent at 120-hour mark
DocuSign sandbox activity log shows second reminder event at day 5
T12
Post-signature filing: executed contract saved to Google Drive
DocuSign sandbox envelope marked Completed (all parties signed)
Executed PDF retrieved from DocuSign and saved to the executed-contracts folder in Google Drive with standardised naming
File exists in correct subfolder; filename matches EXECUTED_CLIENT_ContractType_YYYY-MM-DD pattern; file is the signed PDF not the draft
T13
HubSpot CRM update on execution
DocuSign sandbox envelope marked Completed
HubSpot deal record updated: contract status field set to Executed; link to Google Drive executed file written to deal notes
HubSpot sandbox deal record shows correct contract status value and a valid Google Drive URL in the notes field
T14
Xero draft invoice creation on execution
DocuSign sandbox envelope marked Completed; HubSpot deal record contains fee amount and payment terms
Draft invoice created in Xero demo company with correct contact, line item description, amount, and due date derived from payment terms
Xero demo company shows a Draft invoice; contact name matches HubSpot client; amount matches fee field; due date calculated correctly from payment terms
T15
Failure mode: DocuSign envelope creation fails (API error)
Valid approval payload; DocuSign sandbox configured to return a 500 error on envelope creation
Agent logs DocuSign API error; does not proceed to send; internal alert sent; run marked failed
Run history shows error state with DocuSign error code; alert received in Gmail test inbox; no orphaned envelope in DocuSign
T16
Failure mode: Xero invoice creation fails (authentication error)
DocuSign envelope Completed; Xero OAuth token expired in sandbox
Agent logs Xero authentication error; files the contract to Google Drive and updates HubSpot regardless; sends alert that Xero step requires manual completion
Google Drive and HubSpot steps confirmed complete; Xero shows no invoice; alert received specifying Xero authentication failure and the deal reference
Test and QA PlanPage 2 of 4
FS-DOC-06Quality

03Phase 2 — integration and edge case tests

Integration tests validate data fidelity and correct handoffs between the Contract Drafting Agent and the Signature and Filing Agent, and across all connected tools. All tests run in the sandbox environment with the same credential rules as Phase 1.

ID
Scenario
Input
Expected Output
Pass Criteria
T17
End-to-end sandbox handoff: Drafting Agent output consumed by Signature Agent
Complete sandbox deal triggers Drafting Agent; generated Google Drive file path passed to Signature Agent on approval
Signature Agent reads the correct file from Google Drive without manual path entry; envelope created from the correct draft
DocuSign sandbox envelope attachment matches the Google Drive file created by the Drafting Agent in the same test run; no hardcoded file path used
T18
HubSpot field data passes through to Xero invoice without drift
HubSpot sandbox deal with fee amount of $4,750.00 and net-30 payment terms
Xero draft invoice line item shows $4,750.00 and due date 30 days from contract execution date
Xero amount field matches HubSpot fee field exactly; no rounding; due date calculated from DocuSign completion timestamp plus 30 days
T19
Gmail approval link routes correctly to Signature Agent trigger
Approval email delivered to manager Gmail test inbox; manager clicks approve link
Signature Agent trigger fires within 60 seconds of link click; correct deal record identified from link payload
Automation platform run log shows trigger event timestamp within 60 seconds of link click; deal ID in run payload matches the originating HubSpot deal
T20
Google Drive executed-contracts folder structure matches filing specification
Three sandbox deals from different service types executed through full flow
Each executed contract filed in the correct service-type subfolder under the executed-contracts root
Google Drive folder paths for all three files match the filing specification exactly; no files land in the root or draft folder
T21
HubSpot webhook delivers deal payload within acceptable latency
Deal stage changed to Closed Won in HubSpot sandbox
Automation platform receives the webhook payload and begins the Drafting Agent run within 90 seconds
Run log timestamp is within 90 seconds of the HubSpot stage-change event; full deal payload including all mandatory fields is present in the received webhook body
T22
Concurrent deals: two deals marked won within 30 seconds of each other
Two separate sandbox deals marked Closed Won in rapid succession
Both deals processed independently; no data bleed between runs; each produces a separate correctly named draft
Two separate automation platform run instances visible in history; each run's Google Drive output contains only the data from its own HubSpot deal
T23
Manager requests changes: draft revised and re-routed
Manager clicks request-changes link in Gmail approval email; revised draft uploaded to same Google Drive path
Approval notification re-sent to manager with link to revised file; Signature Agent does not fire until a subsequent approve action
Second approval email received in Gmail test inbox referencing the revised file; no DocuSign envelope created until the approve link is clicked on the revised version
T24
Xero contact lookup: existing Xero contact matched by HubSpot email
HubSpot deal where client email matches an existing contact in Xero demo company
Xero invoice created against the existing contact record, not a duplicate
Xero demo company shows one contact record for the client; invoice is attached to the pre-existing contact; no duplicate contact created

Edge case tests below cover scenarios outside the happy path that the automation must handle gracefully without silent failure or data corruption.

ID
Scenario
Input
Expected Output
Pass Criteria
E01
Duplicate deal trigger: same deal ID fires the webhook twice
HubSpot sandbox deal stage changed to Closed Won; webhook delivered twice due to simulated retry
Automation platform detects duplicate run via deal ID idempotency check; second run is suppressed or skipped; only one draft created
Google Drive contains exactly one draft file for the deal; run log shows second trigger identified as duplicate and halted; no duplicate DocuSign envelope
E02
Missing client email address in HubSpot deal record
Sandbox deal with all fields populated except the client contact email
Drafting Agent completes draft creation and filing; Signature Agent halts at envelope dispatch step and raises an alert specifying missing email
Draft file exists in Google Drive; DocuSign envelope not created; alert received in Gmail test inbox referencing missing email field and deal ID
E03
HubSpot API rate limit exceeded during field read
Automation platform configured to simulate a HubSpot 429 response on the deal record fetch
Automation platform applies exponential back-off; retries up to three times; if all retries fail, run is marked failed and alert sent
Run log shows retry events with back-off intervals; after three failed attempts run status is Error; alert received; no partial draft created
E04
Google Drive unavailable during draft save
Drafting Agent completes field population; Google Drive API returns 503 on file write
Agent retries write up to three times; on persistent failure, run marked failed and alert sent; no silent data loss
Run log shows retry attempts; final status is Error after three failures; alert received; no corrupted partial file in Google Drive
E05
DocuSign unavailable during envelope creation
Signature Agent receives approval trigger; DocuSign API returns 503
Agent retries up to three times with back-off; on persistent failure, run marked failed; alert sent specifying the approved deal is awaiting envelope creation
Run log confirms retry pattern; alert received with deal reference; no envelope created; HubSpot and Xero steps do not proceed
E06
Manager approval link clicked after 48-hour expiry
Approval link generated with 48-hour expiry; manager clicks link after expiry window
Automation returns an expired link response to the manager; a new approval notification is triggered automatically with a fresh link
Manager receives a second approval email with a new valid link; original link returns an error page; no duplicate draft is created
E07
Manager does not respond to approval request within 72 hours
Approval email sent; no action taken for 72 hours
Escalation reminder sent to the manager and a secondary approver (as configured) at the 72-hour mark; run remains in pending state
Escalation email received by both configured recipients at the correct time; automation platform run log shows pending state; no automatic approval or cancellation triggered
E08
Contract template file deleted from Google Drive template library mid-run
Sandbox deal triggers Drafting Agent; template file is deleted from Google Drive before the agent reads it
Agent returns a file-not-found error; no draft created; alert sent specifying the missing template filename and service type
Run log shows file-not-found error from Google Drive; no draft created; alert received with template filename; run does not attempt to use a fallback template without explicit configuration
Test and QA PlanPage 3 of 4
FS-DOC-06Quality

04Phase 3 — end-to-end production test

Important before running Phase 3: all production test runs must use an internal test email address for the DocuSign recipient. Do not send a live envelope to a real client. The HubSpot deal created for testing must be labelled TEST in the deal name and deleted or archived immediately after sign-off is confirmed. The Xero invoice created during the test must be voided in Xero before the test session closes. The Google Drive executed-contracts folder must be checked to confirm the test file is moved to a clearly marked test-archive subfolder. FullSpec will confirm each cleanup step in the test session log before Phase 3 is marked complete.

Phase 3 runs against live production credentials and live tool accounts. The FullSpec team leads each test run and the process owner is present for T28 and T29. All results are recorded in the FullSpec confirmation log. Phase 3 does not begin until every Phase 2 case carries a confirmed pass status.

ID
Scenario
Steps Traced
Expected Output
Pass Criteria
T25
Full production run: deal to executed contract
HubSpot production deal marked Closed Won with all mandatory fields; trace through Drafting Agent, Google Drive save, Gmail approval, DocuSign dispatch, signature completion (internal test address), Google Drive filing, HubSpot update, Xero invoice
Every step completes without manual intervention outside the designated approval gate; executed contract filed in production Google Drive; HubSpot deal updated; Xero draft invoice created
All eight automated steps visible in run log with success status; executed PDF present in production executed-contracts folder with correct naming; HubSpot contract status field updated; Xero invoice in Draft state with correct amount and contact; total elapsed time from trigger to Xero invoice under 10 minutes excluding signature wait
T26
Error log verification: deliberate bad field triggers correct alert in production
Production deal created with fee amount field deliberately left blank; automation triggered
Drafting Agent halts; no draft saved to production Google Drive; alert email delivered to configured production alert inbox within 5 minutes
No file in Google Drive; alert received in production alert inbox within 5 minutes; error log entry in automation platform references the correct deal ID and the specific missing field; run status shows Error not Unknown
T27
Reminder sequence confirmed in production DocuSign
Production DocuSign envelope dispatched to internal test address; signer takes no action for 3 days
DocuSign sends automated reminder to the internal test address at day 3
Reminder email received at internal test address; DocuSign account activity log shows reminder event; no manual action taken by FullSpec or process owner to trigger the reminder
T28
Approval gate: process owner reviews and approves production test contract
Production draft contract generated from test deal; approval email delivered to process owner's production Gmail inbox; process owner clicks approve
Signature and Filing Agent fires within 60 seconds of approval click; DocuSign envelope dispatched to internal test address; process owner sees no errors during their session
Process owner confirms receipt of approval email and successful link click; automation platform run log shows Signature Agent trigger within 60 seconds; DocuSign envelope visible in production account with internal test address as recipient; process owner verbally confirms the contract content and naming are correct
T29
Process owner final review and sign-off recorded in FullSpec confirmation log
All T25 to T28 results reviewed by process owner; cleanup of test deal, test file, and Xero invoice confirmed complete
Process owner confirms all automated steps performed correctly, all outputs match expectations, and all test records have been voided or archived. Sign-off is recorded by the FullSpec team in the FullSpec confirmation log with the process owner's name, role, and timestamp.
FullSpec confirmation log entry created with: process owner name, role (Operations Manager), confirmation statement, timestamp, and a reference to this document (FS-DOC-06). No open failures remain in Phases 1, 2, or 3. Automation cleared for go-live. Process owner receives a copy of the completed confirmation log at support@gofullspec.com.
Once T29 is recorded in the FullSpec confirmation log, the automation is cleared for go-live. Contact the FullSpec team at support@gofullspec.com if any Phase 3 case requires re-testing or if a production credential needs to be rotated before the go-live date.
Test and QA PlanPage 4 of 4

More documents for this process

Every document generated for Contract Generation & Management.

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