Back to Commission & Payout Calculation

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

Commission and Payout Calculation

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

This document defines the complete test and quality assurance programme for the Commission and Payout Calculation automation. It is written for the FullSpec build team and covers every test case required to confirm that each agent, each integration, and the full end-to-end production flow behaves correctly before go-live. Tests are organised into three sequential phases: unit, integration and edge case, and end-to-end production. No phase begins until the previous phase has fully passed. The process owner joins Phase 3 to review and record final approval.

01Testing approach

Testing runs in three phases in sequence. Phase 1 isolates each agent and confirms individual logic. Phase 2 tests cross-agent handoffs and adversarial edge cases. Phase 3 executes one complete run against the production environment with real credentials and real records. No phase begins until every test case in the previous phase carries a Pass status and has been documented in the FullSpec run log.

1
Phase 1: Unit Testing
Estimated time: 1 to 2 days
Scope
Each agent tested in isolation: Deal Ingestion Agent, Commission Calculation Agent, Payout Distribution Agent
Environment
Sandbox only. HubSpot sandbox portal, Google Sheets test workbook, Gusto test environment, Xero demo company, Slack test workspace
Credential rule
Sandbox credentials exclusively. No production API keys, no production Gusto pay run, no live Xero company
Pass condition
All cases T01 through T15 return the expected output with no unhandled exceptions
Who runs it
FullSpec team only
2
Phase 2: Integration and Edge Case Testing
Estimated time: 1 to 2 days
Scope
Agent-to-agent handoffs, tool API boundaries, and adversarial inputs including duplicates, missing fields, unavailable services, and approval timeout
Environment
Sandbox for all integration handoff tests. Edge cases that require simulating a tool outage use a mock endpoint or offline stub
Credential rule
Sandbox credentials only. No production keys introduced at this phase
Pass condition
All cases T16 through T24 pass, and all edge cases E01 through E07 resolve without data corruption or unhandled errors
Who runs it
FullSpec team only
3
Phase 3: End-to-End Production Test
Estimated time: 1 day, run against one live pay period
Scope
Full workflow from scheduled trigger through to rep Slack notification, using production credentials and a controlled test record set
Environment
Production. HubSpot live portal, live Google Sheets workbook, Gusto live pay run (test additional earnings entry voided after test), Xero live company (journal voided after test), Slack production workspace
Credential rule
Production credentials used for the first time in this phase. All test records must be clearly flagged and voided on completion
Pass condition
All cases T25 through T28 pass, including process owner review and sign-off recorded as case T28
Who runs it
FullSpec team executes; process owner joins to review output and record approval for T28
Test and QA PlanPage 1 of 4
FS-DOC-06Quality

02Phase 1 — unit test cases

All Phase 1 tests must be run with sandbox credentials only. Do not connect production HubSpot, Gusto, Xero, or Slack accounts at this stage. Use the designated sandbox workbook in Google Sheets and the FullSpec test HubSpot portal. Any test that inadvertently touches a production system is an automatic Phase 1 failure and requires a full credential audit before retesting.

Deal Ingestion Agent — unit test cases

ID
Scenario
Input
Expected output
Pass criteria
T01
Happy path: standard closed-won deal fetch
HubSpot sandbox contains 8 closed-won deals within the pay period date range, all with valid rep owner IDs and deal values
Google Sheets test tab populated with 8 rows, one per deal, each containing: deal ID, rep ID, close date, deal value, period label
Row count equals 8; no null values in deal ID, rep ID, or deal value columns; period label matches configured pay period
T02
Test and voided records are excluded
HubSpot sandbox contains 8 closed-won deals plus 2 records flagged as test deals via the is_test custom property
Google Sheets tab contains exactly 8 rows; the 2 test records do not appear
Row count equals 8; no deal with is_test = true present in output sheet
T03
Zero deals in period
HubSpot sandbox has no closed-won deals within the configured pay period date range
Google Sheets tab is written with a header row only; workflow posts a Slack alert to the FullSpec monitoring channel noting zero deals found
Sheet contains header row only; Slack alert received within 60 seconds of trigger; workflow does not proceed to Commission Calculation Agent
T04
Deal missing owner ID
7 deals with valid owner IDs plus 1 deal where the HubSpot owner field is null
7 deals written to main sheet; 1 deal written to exceptions tab with flag: missing_rep_id
Main sheet row count equals 7; exceptions tab contains 1 row for the deal with null owner; exception reason column reads missing_rep_id
T05
HubSpot API authentication failure
HubSpot sandbox OAuth token is expired (force-expiry in test environment)
Workflow catches the 401 response, logs the error with timestamp and step reference, sends a Slack alert to the monitoring channel, and halts without writing to Google Sheets
Error log entry present with status 401 and step reference deal_ingestion_fetch; Slack alert received; Google Sheets tab unmodified

Commission Calculation Agent — unit test cases

ID
Scenario
Input
Expected output
Pass criteria
T06
Happy path: standard single-tier commission
Google Sheets test tab with 3 deals for Rep A (total deal value $30,000); rate table shows 10% for attainment 0 to 100%
Payout summary tab shows Rep A: 3 deals, $30,000 revenue, 10% rate, $3,000 gross commission
Gross commission value equals $3,000; rate applied equals 10%; deal count equals 3
T07
Tiered rate: rep crosses quota attainment threshold
Rep B has $60,000 in deals; quota is $50,000; rate table: 0 to 100% attainment = 8%, over 100% = 12%
First $50,000 at 8% = $4,000; remaining $10,000 at 12% = $1,200; gross commission = $5,200
Gross commission equals $5,200; rate table correctly split at quota boundary; no rounding error exceeding $0.01
T08
Split deal between two reps
One deal worth $20,000 with a 60/40 split between Rep C and Rep D as defined in the split field
Rep C receives commission on $12,000; Rep D receives commission on $8,000; both appear as separate rows in payout summary
Rep C base equals $12,000; Rep D base equals $8,000; split percentages sum to 100%; each rep row is distinct in the summary tab
T09
Clawback applied from prior period
Rep E has $25,000 in new deals this period; clawback tab contains a $2,000 deduction carried from the prior period for Rep E
Gross commission calculated on $25,000, then $2,000 clawback deducted; net commission displayed with clawback line item shown separately
Net commission equals gross minus $2,000; clawback line item visible in payout detail; clawback source reference matches prior period record
T10
Deal cannot be matched to a rate tier
One deal for Rep F where the product line field does not match any entry in the rate table
Deal written to exceptions tab with flag: unmatched_rate_tier; Rep F payout row shows partial total with note that one deal is pending review
Deal appears in exceptions tab with flag unmatched_rate_tier; Rep F payout row marked as incomplete; deal excluded from gross commission calculation
T11
Rep ID in deal does not exist in rate table
Deal assigned to a HubSpot owner ID that has no corresponding entry in the rep master list on the rate table sheet
Deal written to exceptions tab with flag: unknown_rep_id; no payout row created for that rep
Exception tab contains deal with flag unknown_rep_id; no row for the unknown rep appears in payout summary
T12
Zero-value deal included in CRM export
One deal with deal value of $0 in the ingested dataset alongside 5 normal deals
Zero-value deal written to exceptions tab with flag: zero_value_deal; it is excluded from commission calculation
Exceptions tab contains the zero-value deal; commission calculation runs only on the 5 normal deals; no division-by-zero error thrown

Payout Distribution Agent — unit test cases

ID
Scenario
Input
Expected output
Pass criteria
T13
Happy path: Slack approval message sent correctly
Approved payout summary in Google Sheets with 4 reps and total commission $18,500; manager Slack user ID configured correctly
Slack message delivered to manager containing a formatted summary table and Approve and Flag buttons; workflow pauses awaiting response
Slack message received by manager account in sandbox workspace; message contains all 4 rep rows with correct totals; workflow status is paused
T14
Gusto additional earnings entry created after approval
Manager clicks Approve in sandbox Slack; 4 reps with commission totals mapped to Gusto employee IDs
4 additional earnings entries created in Gusto test environment, one per rep, each with the correct amount and earnings type code
Gusto test environment shows 4 additional earnings entries; amounts match approved payout summary; no duplicate entries created
T15
Xero journal entry created and rep Slack DMs sent
Gusto push confirmed; total commission expense $18,500; Xero demo company configured with correct account codes
Xero demo company shows one journal entry debiting commission expense account and crediting payroll liability account for $18,500; each of 4 reps receives a Slack DM with their individual breakdown
Xero journal entry present with correct debit and credit lines summing to $18,500; 4 Slack DMs received in sandbox, each containing the correct rep name, deal count, rate, and gross commission
Test and QA PlanPage 2 of 4
FS-DOC-06Quality

03Phase 2 — integration and edge case tests

Phase 2 integration tests — agent handoffs

ID
Scenario
Input
Expected output
Pass criteria
T16
Deal Ingestion Agent output triggers Commission Calculation Agent correctly
Deal Ingestion Agent completes and writes a clean 10-row deal list to the designated Google Sheets tab
Commission Calculation Agent triggers automatically within 30 seconds of sheet write completing; reads all 10 rows without manual intervention
Commission Calculation Agent execution log shows trigger timestamp within 30 seconds of sheet write; input row count in log equals 10
T17
Commission Calculation Agent output triggers Payout Distribution Agent after approval
Commission Calculation Agent completes payout summary; Slack approval message delivered; manager approves
Payout Distribution Agent triggers within 60 seconds of approval click; reads the approved payout summary from Google Sheets
Payout Distribution Agent execution log shows trigger event as manager_approval_confirmed; payout summary row count matches Commission Calculation Agent output
T18
Partial Google Sheets write: ingestion agent fails mid-write
Ingestion agent begins writing to Google Sheets but the connection drops after 5 rows are written (simulated by cutting the test session mid-execution)
Workflow detects the incomplete write on resume, clears the partial data, and retries the full fetch-and-write cycle from the beginning
On retry, Google Sheets tab contains only a complete fresh dataset with no duplicate or partial rows; retry log entry present
T19
Commission Calculation Agent reads stale rate table version
Rate table sheet has a locked version header; agent reads a tab that was accidentally left at a prior period's rates
Agent detects the version mismatch via the version_date cell in the rate table header, flags the issue, and sends a Slack alert to the monitoring channel without proceeding to calculation
Slack monitoring alert received noting rate_table_version_mismatch; calculation does not run; payout summary tab remains blank
T20
Gusto employee ID not found for one rep
Payout Distribution Agent attempts to push 4 rep entries to Gusto; one rep's Gusto employee ID field in the mapping table is blank
3 Gusto entries created successfully; 1 entry fails and is written to the exceptions log with flag: gusto_employee_id_missing; Slack alert sent to monitoring channel
Gusto test environment shows 3 entries; exceptions log contains 1 row with gusto_employee_id_missing; Slack alert received; no unhandled exception thrown
T21
Xero API rate limit hit during journal entry creation
Xero demo company API is configured to return HTTP 429 after the first request in a test session
Workflow catches the 429 response, waits the retry-after interval (60 seconds), retries the journal entry creation once, succeeds on retry
Xero journal entry present after retry; execution log shows one 429 event followed by a 60-second wait and successful retry; no duplicate journal entry created
T22
Slack DM delivery fails for one rep
4 reps in payout summary; one rep's Slack user ID is invalid in the sandbox workspace
3 Slack DMs delivered successfully; 1 delivery failure logged with flag: slack_user_not_found; monitoring channel alerted; workflow completes without halting
3 DMs received in sandbox; exceptions log contains 1 row with slack_user_not_found for the affected rep; monitoring alert received
T23
Full pipeline run in sandbox with 40 deal records
Sandbox HubSpot contains 40 closed-won deals across 6 reps, including one split deal, one clawback, and one unmatched rate tier
Payout summary produced for 6 reps; split deal correctly allocated; clawback deducted; unmatched deal in exceptions tab; Slack approval message sent; on approval, Gusto entries, Xero journal, and rep DMs all created
Payout summary row count equals 6; exceptions tab contains 1 row; Gusto has 6 entries; Xero journal entry total matches sum of gross commissions; 6 Slack DMs received
T24
Manager clicks Flag instead of Approve
Payout summary has 4 reps; manager clicks Flag in the Slack approval message
Workflow pauses; a follow-up Slack message is sent to the manager asking for specific exception details; Payout Distribution Agent does not trigger; payout summary tab is locked from further agent writes
Payout Distribution Agent execution log shows no trigger event after flag click; follow-up Slack message received by manager; payout summary tab status cell reads flagged_pending_review

Phase 2 edge case tests

ID
Scenario
Input
Expected output
Pass criteria
E01
Duplicate deal IDs in HubSpot export
HubSpot sandbox returns 10 deals including 2 records with identical deal IDs (simulating a CRM data quality issue)
Ingestion agent detects duplicate deal IDs, retains the record with the most recent close date, writes the duplicate to the exceptions tab with flag: duplicate_deal_id
Main sheet has 9 unique deal rows; exceptions tab contains 1 row with duplicate_deal_id; no duplicate appears in commission calculation input
E02
Deal value field contains non-numeric data
One deal record has deal value entered as the string 'TBC' in HubSpot
Ingestion agent flags the record in the exceptions tab with flag: non_numeric_deal_value; the record is excluded from calculation
Exceptions tab contains the record with non_numeric_deal_value; main calculation proceeds on remaining clean deals without error
E03
Google Sheets rate table is empty
Commission Calculation Agent triggers but the rate table tab in Google Sheets contains only headers and no data rows
Agent detects empty rate table, halts calculation, sends Slack alert to monitoring channel with flag: rate_table_empty, and does not write to payout summary tab
Payout summary tab is empty; Slack monitoring alert received with flag rate_table_empty; execution log shows halt at rate_table_validation step
E04
HubSpot API unavailable during scheduled trigger
Scheduled pay period trigger fires but HubSpot sandbox API returns HTTP 503
Workflow retries the HubSpot request up to 3 times with exponential backoff (30 seconds, 60 seconds, 120 seconds); after 3 failures, a Slack alert is sent and the workflow halts
Execution log shows 3 retry attempts with correct intervals; Slack alert received after third failure; no partial data written to Google Sheets
E05
Manager does not respond to Slack approval message within the timeout window
Payout Distribution Agent sends Slack approval message; manager takes no action for the configured timeout period (set to 48 hours in test, simulated by fast-forwarding the workflow clock)
Workflow sends a Slack reminder to the manager at the 24-hour mark; at 48 hours, sends a final alert to the monitoring channel and pauses indefinitely without proceeding to Gusto or Xero
Reminder message received at 24-hour mark; monitoring alert received at 48-hour mark; Gusto and Xero remain unmodified; workflow status shows approval_timeout
E06
Pay period triggers twice in the same period due to misconfigured schedule
Workflow trigger fires a second time within an already-processed pay period (same period label)
Workflow detects that the current period label already has a completed run in the run log, skips execution, and sends a Slack alert to the monitoring channel with flag: duplicate_period_run
No new data written to Google Sheets; no Gusto entries created; Slack monitoring alert received with duplicate_period_run; existing payout data unmodified
E07
Rep has zero qualifying deals in the period
Commission Calculation Agent processes a period where Rep G is on the rep master list but has no closed-won deals assigned to them
Rep G appears in payout summary with $0 gross commission and a note of zero_qualifying_deals; no Gusto additional earnings entry is created for Rep G; Rep G Slack DM states zero commission for the period
Rep G row in payout summary shows $0 and zero_qualifying_deals note; Gusto entries do not include Rep G; Rep G receives a Slack DM confirming zero commission
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 record set in the production HubSpot portal. Create a small number of clearly labelled test deals (for example, deal name prefixed with TEST-QA) and assign them to an internal team member, not a real rep. Verify that the Gusto additional earnings entry created during this test is voided immediately after confirming the pass criteria. Verify that the Xero journal entry created is also voided or deleted before the period closes. Confirm with the process owner that no rep Slack DMs go to live rep accounts during this test: use a dedicated internal Slack user or the monitoring channel as the DM recipient for this run only. Do not proceed with Phase 3 until all Phase 1 and Phase 2 cases are documented as passed in the FullSpec run log.
ID
Scenario
Input
Expected output
Pass criteria
T25
Full end-to-end production run: trigger through payout summary
Production HubSpot portal contains 3 TEST-QA labelled closed-won deals in the current pay period, assigned to a designated internal test user with a corresponding rate table entry in the production Google Sheets workbook
Workflow triggers on schedule; fetches 3 TEST-QA deals from production HubSpot; writes a clean 3-row deal list to the production payout ledger sheet; Commission Calculation Agent applies rate tiers and produces a payout summary; Slack approval message sent to the designated approver (process owner or FullSpec team member)
HubSpot fetch returns exactly 3 TEST-QA deals; Google Sheets ledger shows 3 rows with correct deal IDs, rep ID, period label, and deal values; payout summary shows correct gross commission per tier; Slack approval message received with correct summary table
T26
Production approval flow: manager approves and downstream systems updated
Process owner or designated approver clicks Approve on the production Slack message from T25
Payout Distribution Agent triggers; one additional earnings entry created in Gusto live environment for the test user; one journal entry created in Xero live company; one Slack DM sent to the internal test recipient confirming the breakdown
Gusto live environment shows one additional earnings entry for the test user with the correct amount and earnings type; Xero live company shows one journal entry with correct debit and credit lines; Slack DM received by internal test recipient with correct deal count, rate, and gross commission
T27
Error log and audit trail verification
Completed production run from T25 and T26, including the exceptions tab (should contain zero records for this clean test dataset)
FullSpec execution log shows a complete run record: trigger timestamp, step-level durations, input and output row counts at each agent, approval event timestamp, Gusto entry reference, Xero journal entry reference, and Slack delivery confirmations
Execution log entry exists for the full run; all step statuses show success; no unresolved exceptions in the exceptions tab; Gusto reference ID recorded; Xero journal ID recorded; each Slack delivery has a confirmed timestamp; audit trail links each payout line to a specific HubSpot deal ID
T28
Process owner review and approval sign-off
Process owner reviews the completed T25 to T27 test outputs: the payout summary in Google Sheets, the Gusto test entry, the Xero test journal, the Slack DM content, and the FullSpec execution log
Process owner confirms that all outputs are accurate and match expectations; confirms that the Gusto and Xero test entries have been voided; records approval in the FullSpec confirmation message sent by the FullSpec team
Process owner has reviewed all Phase 3 outputs and confirmed accuracy; test Gusto entry voided and confirmed; test Xero journal voided and confirmed; process owner approval recorded in the FullSpec project confirmation log with name, date, and a note of any outstanding observations; no separate signoff block is required
Once T28 is recorded as passed, the build is cleared for go-live under the parallel run protocol defined in the Launch Plan. Any outstanding observations noted by the process owner during T28 must be resolved and retested before the first live pay period run is submitted to Gusto. Contact the FullSpec team at support@gofullspec.com with your T28 confirmation to initiate the go-live handover.
Test and QA PlanPage 4 of 4

More documents for this process

Every document generated for Commission & Payout Calculation.

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