AI Systems Test Strategy

Oct 20, 2026 · @Santosh Karad

Purpose and scope

This strategy defines how QA verifies every AI-powered system we build or buy: no AI change reaches production without passing a versioned evaluation suite and a security review. It replaces exact-match test cases with statistical, rubric-based evaluation and extends testing into production.

System under testWhat we own and testOut of scope
AI models (foundation, fine-tuned, ML classifiers)Fitness for our use cases, bias, robustness, version driftVendor pre-training and vendor-internal safety work
Chatbots and RAG assistantsAnswers, retrieval, grounding, multi-turn behaviour, safetyUnderlying model weights
AI agents (tool-using, multi-step)Plans, tool calls, side effects, permissions, costThird-party APIs the agent calls (mocked)
AI voice agentsAll chatbot checks plus speech, latency, turn-taking, telephonyCarrier network quality
AI-written codeCorrectness, security, maintainability of code generated by assistantsThe coding assistant product itself

Applies to all teams shipping AI features, internal tools, and vendor AI products before procurement sign-off.

Testing principles

AI output is non-deterministic and open-ended, so we test behaviour as a distribution and accept a measured pass rate, not a single correct answer.

Traditional testingAI testing (this strategy)
Exact expected outputRubric: what a good answer must and must not contain
Pass / fail per casePass rate per suite, with a threshold
One run per caseMultiple runs per case; variance tracked
Test cases in a toolVersioned golden datasets in the repo
Testing ends at releaseProduction traffic is sampled and scored continuously
Tester judges outputCode checks, calibrated AI judges and humans, layered

Guiding rules:

  1. Test the system, not the model. Prompts, retrieval, tools and guardrails change behaviour as much as the model does.
  2. Every change is a regression risk. A prompt edit, model upgrade or new document in the knowledge base triggers the eval suite.
  3. Measure the cost of being wrong. Thresholds are set per use case by business impact, not one global number.
  4. Assume adversarial users. Security and misuse testing is part of every release, not a one-off audit.
  5. Humans stay in the loop for high-impact decisions and for calibrating automated graders.

Evaluation framework

Every AI feature ships with a golden dataset and three layers of graders; this is the backbone all later sections reuse.

Golden datasets

Grader layers

LayerChecksSpeed and costUse for
Code-basedSchema, JSON validity, regex, banned terms, length, tool-call arguments, exact factsFast, free, deterministicEverything that can be checked mechanically
AI judge (LLM-as-judge)Rubric scoring: correctness, groundedness, tone, completeness, policy adherenceMediumOpen-ended quality at scale
Human reviewAmbiguous cases, judge disagreements, high-risk domainsSlow, costlyCalibration and final sign-off

AI judge rules

Run policy

Approach: AI models

We select and accept models on our own domain data; public leaderboards inform the shortlist, never the decision.

Test areaWhat we checkHow
Task performanceAccuracy, F1, or rubric pass rate on our golden setOffline eval, compared across candidate models
RobustnessStable output under typos, paraphrase, casing, code-mixed language (e.g. Hinglish), long inputsPerturbation suites generated from the golden set
CalibrationConfidence matches correctness; model says "I don't know" when it shouldUnanswerable-question set; abstention rate
Bias and fairnessEqual quality across gender, region, language, age-related cuesSlice metrics; counterfactual pairs that swap only one attribute
Version driftNo regression when the provider updates or we fine-tuneFull regression run on every model version; side-by-side diff
Data and training (fine-tuned / ML)No train–test leakage, label quality, data lineageDedup checks, label audits, holdout sets never seen in training
Non-functionalLatency p50/p95, throughput, cost per 1,000 requests, context limitsLoad tests against the serving endpoint

Model acceptance criterion: a new or upgraded model must match or beat the current model on the regression set, with no slice dropping more than 3 points.

Approach: chatbots and RAG systems

We test retrieval and generation separately, because a wrong answer from a wrong document needs a different fix than a wrong answer from the right one.

Retrieval layer

Generation layer

Conversation behaviour

Test design: script multi-turn conversations with simulated users (an AI playing defined personas and goals) and score the whole transcript, not only the last reply.

Approach: AI agents

For agents we grade the trajectory (every step it took) as well as the outcome, because an agent can reach the right answer by an unsafe or expensive path.

LevelWhat we checkExample assertion
OutcomeTask completed; end state correct in the target systemTicket created with correct priority and assignee
Tool selectionRight tool chosen, wrong tools not calledUses refund_lookup, never refund_issue for a status query
Tool argumentsArguments valid and grounded in user inputAmount equals the amount the user confirmed
Ordering and planningPrerequisite steps happen firstVerifies identity before changing account data
EfficiencyStep count, tokens, cost, wall-clock time within budget≤ 8 steps and ≤ ₹5 per task (set per use case)
TerminationStops when done or stuck; no infinite loopsExits with a clear message after 3 failed retries
PermissionsAsks for confirmation before irreversible or high-value actionsPayment, deletion and external email always need approval

Environment: agents run in a sandbox with mocked or staging tools. Mocks inject failures — timeouts, 500 errors, empty results, malformed responses, rate limits — to test recovery.

Key scenarios

Every agent run in test and production emits a full trace (prompts, tool calls, results, decisions) so failures can be replayed.

Approach: AI voice agents

Voice agents get every chatbot and agent check plus a speech pipeline layer, tested end to end with simulated callers over real telephony.

Pipeline stageWhat we checkMetric
Speech-to-text (ASR)Accuracy across accents, regional languages, code-mixing, background noise, poor linesWord error rate per slice; entity accuracy for names, numbers, dates, IDs
Understanding and reasoningIntent, slot filling, policy, tool use (same as chatbot and agent sections)Task success rate
Text-to-speech (TTS)Pronunciation of names, amounts, dates, abbreviations; natural prosodyHuman MOS-style rating on a sample
Turn-takingBarge-in (caller interrupts), long pauses, silence, crosstalk, "hello? are you there?"Interrupt handling pass rate
LatencyTime from caller finishing speech to first agent audiop50 and p95 against target set by product
TelephonyDTMF input, call transfer to human, hold, voicemail detection, dropped callsScenario pass rate

Test method

Always score at two levels: per turn (did this reply make sense?) and per call (did the caller achieve their goal?).

Approach: AI-written code

AI-generated code goes through the same pipeline as human code, plus extra gates for the failure modes AI makes more often: invented dependencies, plausible-but-wrong logic, and tests that pass without testing anything.

Mandatory gates

  1. Human review by an engineer who understands the change; the author stays accountable regardless of who or what wrote it.
  2. Static analysis and security scanning (SAST, secrets detection) on every PR.
  3. Dependency check: every new package must exist in the official registry, have real maintainers and pass SCA. AI can invent package names that attackers then register.
  4. Licence check for code that may resemble copied open-source snippets.
  5. Test-quality check: mutation testing on AI-written tests; a test suite that survives most mutations is not testing anything.
  6. Separation: AI must not write both the code and its only tests. At least one side is human-written or human-reviewed against the requirement.

What testers focus on

Tracking: tag AI-assisted PRs and compare their defect escape rate, review rework and incident rate with other PRs each quarter.

Security and red teaming

Every AI release runs an automated attack suite, and every high-risk release also gets manual red teaming; we map findings to the OWASP Top 10 for LLM Applications.

ThreatApplies toTest
Direct prompt injection and jailbreaksAllAttack library (role-play, encoding, multi-turn escalation, other languages)
Indirect prompt injectionRAG, agents, voiceMalicious instructions planted in documents, web pages, emails, tool output
System prompt and config leakageAllExtraction attempts; check no secrets are in prompts at all
Sensitive data disclosureAllAttempts to extract other users' data, PII, internal documents
Excessive agencyAgentsCoax agent into unapproved actions, privilege escalation, data exfiltration via tools
Insecure output handlingAllOutput rendered as HTML/SQL/shell is sanitised; XSS and injection payloads in replies
Denial of walletAllInputs designed to cause long loops, huge outputs or runaway token cost
Voice spoofingVoiceCloned or synthetic voices against voice-based verification
Supply chainModels, codeModel and package provenance; untrusted weights, plugins and MCP servers

Cadence: automated suite in CI on every change; manual red team before first launch and quarterly for high-risk systems; findings become permanent regression cases.

Responsible AI, bias and compliance

Each AI system gets a risk tier at design time, and the tier decides how much fairness, explainability and compliance evidence QA must produce before launch.

Risk tierExamplesRequired evidence
HighCredit, hiring, health, legal, identity verificationFull slice-level fairness report, human review of decisions, explainability check, legal sign-off, quarterly re-test
MediumCustomer support, sales assistants, internal agents with write accessFairness spot checks, harmful-content suite, escalation path tested
LowInternal summarisation, drafting aids with human editHarmful-content suite, basic accuracy eval

Checks

Environments, test data and tooling

We run evals in three environments and standardise on one eval framework and one tracing platform across teams, chosen after a two-week proof of concept.

Environments

Test data

Tooling shortlist (open-source examples to evaluate, not mandates)

NeedCandidate tools
Eval framework and CI gatingpromptfoo, DeepEval, OpenAI Evals, Inspect
RAG metricsRagas, DeepEval
Tracing and observabilityLangfuse, Arize Phoenix, LangSmith (commercial)
Red teaminggarak, PyRIT, promptfoo red-team
Voice agent simulationVendor voice-testing platforms; in-house caller simulator with TTS personas
AI-written codeExisting SAST/SCA (e.g. Semgrep, CodeQL, Snyk), mutation testing (e.g. Stryker, PIT, mutmut)

Selection criteria: CI integration, custom metrics, dataset versioning, self-hosting for data privacy, and cost at our volume.

Entry/exit criteria and quality gates

A release passes only when all exit criteria for its risk tier are met; thresholds below are defaults that product and QA tune per use case and record in the test plan.

Entry criteria (testing starts when)

Exit criteria (release allowed when)

GateHigh riskMedium riskLow risk
Task success on regression set≥ 95%≥ 90%≥ 85%
Hallucination / ungrounded rate≤ 1%≤ 3%≤ 5%
Regression vs current versionNo drop > 1 ptNo drop > 2 ptsNo drop > 3 pts
Critical security findings0 open0 open0 open
Safety policy violations0≤ 0.5%≤ 1%
Latency p95 and cost per taskWithin agreed budgetWithin agreed budgetWithin agreed budget
Human review sample100 cases signed off50 cases20 cases

Suspension criteria: stop testing and return to development if task success drops more than 10 points from baseline, a critical security issue is found, or the eval environment cannot reproduce results.

Metrics and reporting

We report six headline metrics per AI system on one dashboard, broken down by use case, slice and version.

MetricDefinitionAudience
Task success rate% of cases or sessions where the user goal is achievedLeadership, product
Hallucination rate% of answers with unsupported or false claimsProduct, QA, compliance
Safety violation rate% of responses breaching content or action policyCompliance, security
Escalation rate% of sessions handed to a human, and whyOperations, product
Latency p9595th percentile response time (voice: time to first audio)Engineering
Cost per taskModel, tool and infra cost per completed taskFinance, engineering

Supporting QA metrics: judge–human agreement, dataset coverage by intent and language, flaky-case count, security findings open and closed, defect escape rate for AI-assisted code.

Reports: an eval report on every release (pass rates vs thresholds, diff against last version, top failure clusters, sign-offs); a weekly production quality summary; a quarterly AI quality review with leadership.

Production monitoring and feedback loop

Production is the final test environment: we score sampled live traffic every day, and every confirmed failure becomes a permanent regression case.

  1. Canary releasesmall share of traffic first
  2. Sample live traffictraces and user feedback
  3. Score automaticallycode checks and AI judges
  4. Triage failurescluster, then human review
  5. Add to golden seteach failure becomes a test
  6. Fix and re-run evalsmust pass gates to ship

↺ Passing the gates starts the next canary release.

Every production failure becomes a permanent regression test.

Roles and responsibilities (RACI)

QA owns the evaluation datasets and quality gates; product owns the thresholds; engineering owns fixes. R = responsible, A = accountable, C = consulted, I = informed.

ActivityQA leadQA / eval engineersProduct ownerAI/ML engineersDomain SMEsSecurityCompliance / legal
Risk tieringCIACCCR
Golden datasetsARCCRII
Rubrics and judge calibrationARCCRII
Thresholds and exit criteriaRCACCCC
Eval automation in CIARICIII
Red teamingCRICIAI
Fairness and compliance evidenceRRCCCIA
Release sign-offRCACICC
Production monitoringARIRCCI

New skills for the QA team: rubric and eval design, prompt engineering, basic Python for eval pipelines, reading traces, statistics for pass rates and confidence intervals, and AI security testing.

Risks and mitigations

The biggest risk to this strategy is false confidence: green eval dashboards built on datasets or judges that do not reflect real users.

RiskImpactMitigation
Golden set does not reflect real trafficPasses in test, fails in productionRefresh monthly from production samples; track coverage by intent
AI judge drifts or is biasedWrong release decisionsQuarterly re-calibration; human spot checks of 5% of judged cases
Provider silently updates modelUnexplained regressionsPin versions; nightly canary eval on pinned and latest
Non-determinism hides real failuresFlaky gates, ignored resultsMultiple runs per case; flaky cases reviewed, not skipped
Eval cost grows with suite sizeTeams skip evalsTiered suites: small in PR, full nightly and pre-release; cache results
SME time unavailable for labellingSlow or low-quality datasetsAgree SME capacity at project start; use AI pre-labelling with SME review
New attack techniquesExploits in productionUpdate attack library monthly; bug bounty or external red team for high risk
Over-reliance on AI-written testsUntested code pathsMutation testing; human-owned acceptance tests

Rollout roadmap

We start with one pilot chatbot and one agent, prove the gates block a bad release, then extend to every AI system within about six months.

  1. Foundation · weeks 1–4Risk-tier AI systemsFirst golden setEval tool PoC
  2. Suite runs in CI
  3. Pilot · weeks 5–101 chatbot, 1 agentJudges calibratedFirst red team
  4. Gates block a release
  5. Scale · months 3–6All AI systems gatedVoice + code gatesLive monitoring
  6. All AI releases gated
  7. Sustain · month 6 onwardQuarterly red teamAudit-ready evidenceCost tuning

Every AI release is gated within about six months.

Each phase moves on only when its gate is met. Durations are estimates to confirm with team capacity and SME availability.

Open questions