Phase 2 integration tests verify that the two agents hand off correctly and that all six connected tools respond as expected within a staging environment. These cases use live staging API connections and continue the T-sequence from Phase 1.
ID
Scenario
Input
Expected Output
Pass Criteria
T11
Full agent handoff: Ad Data Sync Agent completes write; Campaign Analysis and Alert Agent fires automatically
Staging: sync agent writes 9 campaign rows to staging sheet
Analysis agent triggers within 2 minutes of sheet write completing; all 9 rows evaluated
Analysis agent run timestamp follows sync agent completion; all 9 rows have a score field populated
T12
Slack alert delivery confirmed end-to-end in staging workspace
Analysis agent flags 2 anomalous campaigns in staging
Two distinct Slack messages appear in the staging marketing channel, one per campaign
Message count = 2; each message contains correct campaign name, metric, and action; no duplicate messages
T13
HubSpot staging write with multiple conversion events in a single run
Three conversion events in one agent run, each with a matched staging HubSpot contact
All three HubSpot contact records updated in the same run; no partial write
Three contact records show updated deal source; write count in log = 3; no records skipped
T14
Looker Studio refresh triggered after sheet write completes
Staging sheet updated with new daily data
Looker Studio data source refresh event fires; dashboard reflects updated row data
Refresh event logged; dashboard last-updated timestamp changes within 5 minutes of sheet write
T15
Threshold configuration table is updated mid-test; agent reads new values on next run
Budget threshold for one campaign updated in the Google Sheets config table between two runs
Second run applies the new threshold; first run's threshold no longer referenced
Alert behaviour changes in line with the updated threshold; no cached value used
T16
Both ad platform APIs respond successfully but Google Sheets write token expires mid-run
Staging: token expiry injected after Meta API data is fetched
Agent attempts token refresh; on success, write proceeds with all data; no rows lost
All rows written after token refresh; refresh attempt in log; run completes without manual intervention
T17
Slack API rate limit hit mid-alert batch
4 anomalous campaigns; Slack mock returns 429 after second message
Agent queues remaining messages and retries after back-off; all 4 messages eventually delivered
All 4 Slack messages delivered; retry events in log; no alerts silently dropped
T18
HubSpot write blocked by permission scope error
Staging: HubSpot token missing deals write scope
Error caught; descriptive error logged; Slack and Google Sheets steps are not blocked; partial success reported in run summary
HubSpot write fails with logged permission error; all other steps complete; run summary shows partial success, not full failure
ID
Scenario
Input
Expected Output
Pass Criteria
E01
Duplicate campaign rows: Google Ads API returns the same campaign ID twice in one response
API response with duplicate campaign ID in payload
Deduplication logic retains one row per campaign ID; duplicate is discarded and logged
Sheet contains exactly one row per campaign ID; duplicate discard event in log
E02
Missing spend data: one campaign returns null spend field
API response with spend = null for one campaign
Row written with spend field as null or zero with a data-quality flag; no other rows affected; alert not triggered for this campaign
Null spend row present in sheet with quality flag; no anomaly alert generated for null-spend campaign
E03
Missing UTM parameters on a conversion event
Conversion event with no UTM source or medium fields
HubSpot write skipped for this event; unmatched conversion logged in run summary for manual review
HubSpot record not updated for this event; unmatched conversion appears in run summary log
E04
Google Sheets unavailable (API returns 503) at write time
Mock 503 on Sheets write endpoint
Agent retries 3 times; on continued failure, run aborts cleanly with a failure alert sent to the internal operations Slack channel
Three retries logged; internal failure alert delivered; no partial write; clean abort confirmed
E05
Zero active campaigns returned by both ad platform APIs (e.g. account paused globally)
Both APIs return empty campaign arrays
No rows written to sheet; a status note 'zero campaigns returned' written to the log column; no anomaly alerts fired
Sheet unchanged for data rows; log column updated with status note; no false alerts generated
E06
Human review timeout: Slack alert sent but no manager response within configured window (24 hours)
Anomaly alert delivered to Slack; no reaction or reply recorded within 24 hours
Escalation message sent to Marketing Director (secondary recipient); original alert flagged as unacknowledged in run log
Escalation message delivered to secondary recipient after timeout window; original alert status updated to 'escalated' in log