Quality Assurance & Testing Strategy¶
This document defines the quality assurance (QA) strategy for WhiteLotusAI, covering application functionality, AI orchestration, external integrations, security controls, and deployment readiness.
The objective is to establish a repeatable, evidence-based testing process that detects defects early, protects connected resources, and provides confidence in the behavior of each release.
Documentation status
This page defines the testing strategy and expected quality controls. Documented requirements must not be considered implemented or verified solely because they appear here. Verification requires relevant source inspection, automated test results, or runtime evidence.
1. Objectives¶
The testing strategy aims to:
- Verify correctness: Confirm that application behavior meets documented requirements.
- Protect security boundaries: Validate authentication, authorization, tenant isolation, and data access restrictions.
- Validate AI workflows: Test intent routing, tool selection, argument validation, and model failure handling.
- Protect connected resources: Prevent unintended changes to data in external services.
- Improve reliability: Detect regressions, integration failures, and configuration errors before release.
- Establish release confidence: Require reproducible test evidence and documented acceptance decisions.
2. Testing principles¶
| Principle | Requirement |
|---|---|
| Risk-based testing | Prioritize security boundaries, authentication, integrations, and high-impact workflows. |
| Automation first | Automate repeatable checks wherever practical. |
| Deterministic tests | Mock nondeterministic or external dependencies when testing application logic. |
| Defense in depth | Verify critical controls at multiple appropriate layers. |
| Safe execution | Use isolated test environments and prevent unintended external side effects. |
| Reproducibility | Record the commands, environment, test results, and relevant failures. |
| Evidence-based acceptance | Distinguish implemented behavior from assumptions and unverified requirements. |
3. Test levels and scope¶
The following levels define the expected testing coverage. They are a strategy, not a claim that every category is already automated in the repository.
| Test level | Primary scope | Expected evidence |
|---|---|---|
| Unit | Individual functions, classes, validators, and business rules | Unit test results |
| Integration | Communication between services, databases, queues, caches, and adapters | Integration test results |
| API | Request validation, response schemas, authentication, authorization, and error handling | API test results |
| End-to-end | Complete user workflows across the frontend and backend | Workflow execution results |
| Regression | Previously fixed defects and existing critical behavior | Regression suite results |
| Security | Access control, input validation, secrets handling, and abuse resistance | Security test findings |
| Performance | Latency, throughput, concurrency, and resource consumption | Benchmark results |
| Deployment | Startup, health checks, configuration, migrations, and rollback behavior | Deployment verification record |
3.1 Recommended test pyramid¶
Use a test pyramid to balance fast feedback with realistic system validation.
flowchart TB
E2E["End-to-end tests<br/>Critical user journeys"]
API["API and service integration tests<br/>Contracts and boundaries"]
UNIT["Unit tests<br/>Business rules and validators"]
E2E --> API
API --> UNIT
classDef e2e fill:#E8DDFB,stroke:#805AD5,color:#30204F,stroke-width:1.5px
classDef api fill:#DCEBFA,stroke:#3975B7,color:#17365D,stroke-width:1.5px
classDef unit fill:#D9F2E6,stroke:#23835B,color:#174B37,stroke-width:1.5px
class E2E e2e
class API api
class UNIT unit
-
Unit tests
Fast, isolated checks for business rules, argument validation, authorization decisions, and error handling.
-
API and integration tests
Verify service contracts, HTTP behavior, message queues, database interactions, and provider adapters.
-
End-to-end tests
Exercise critical workflows, including authentication, document retrieval, chat interactions, and authorized tool execution.
-
Security and deployment tests
Validate access restrictions, safe configuration, service startup, migration behavior, and release readiness.
4. AI orchestration testing¶
AI workflows require testing beyond conventional request-response validation. WhiteLotusAI must distinguish deterministic application rules from probabilistic model behavior.
4.1 Required AI test scenarios¶
| Scenario | Validation objective |
|---|---|
| Intent routing | Requests are routed to the appropriate workflow or clarification path. |
| Tool selection | Only tools appropriate to the user's request and permissions are selected. |
| Argument validation | Missing, malformed, unexpected, or incorrectly typed arguments are rejected safely. |
| Ambiguous requests | The application requests clarification rather than inventing missing details. |
| Untrusted content | Instructions embedded in emails, documents, or other retrieved content cannot override application policy. |
| Model failures | Timeouts, unavailable providers, malformed outputs, and empty responses are handled safely. |
| Retry behavior | Retries are bounded and do not produce unintended duplicate operations. |
| Output validation | Model outputs are checked before they are rendered or used by downstream components. |
| Permission enforcement | Tool execution independently enforces the authenticated user's permissions. |
| Confirmation enforcement | Any required confirmation is validated by trusted application logic, not accepted solely from model-generated fields. |
| Read-only enforcement | Disallowed write operations are rejected at the execution boundary. |
| Data leakage | Responses do not disclose unauthorized documents, credentials, tokens, or other sensitive information. |
4.2 Deterministic and model-based tests¶
Use deterministic tests for application rules and controlled evaluation for model-dependent behavior.
Use fixed inputs and expected outcomes to validate:
- Intent and authorization routing rules.
- Tool registry membership and execution permissions.
- Schema and argument validation.
- Read-only policy enforcement.
- Error mapping, retries, and timeout handling.
- Rejection of unauthorized tool calls.
Acceptance: Identical controlled inputs should produce the expected application-level result.
Evaluate model-dependent behavior using representative, versioned test cases.
- Test paraphrases, ambiguous prompts, and incomplete context.
- Measure appropriate tool selection and clarification behavior.
- Include adversarial and prompt-injection examples.
- Record model identifiers, configuration, evaluation results, and known limitations.
- Use approved thresholds for task-specific quality metrics.
Acceptance: Results meet the project's defined evaluation thresholds, with critical security failures treated as release blockers.
Warning
A model refusing an unsafe request in a sample conversation is not proof of enforcement. Security restrictions must be applied and tested in trusted application code at the relevant execution boundary.
5. Integration testing and external services¶
WhiteLotusAI integrates with external services that may contain confidential business information. Integration tests must validate both provider behavior and the application's authorization boundaries.
5.1 Integration test requirements¶
- Mock external providers for routine, deterministic test execution.
- Use isolated test accounts and synthetic data for approved live integration tests.
- Validate token handling, expired credentials, refresh failures, rate limits, and provider errors.
- Verify that user identity and authorization context are preserved across service boundaries.
- Test message-queue correlation, timeout handling, and failed request/reply interactions where applicable.
- Ensure logs and error responses do not expose access tokens, internal secrets, or confidential payloads.
- Verify cleanup of temporary resources created by test execution.
5.2 Read-only integration safety¶
The initial integration scope is read-only. This restriction must be enforced independently of the model's intent or generated output.
| Control | Required validation |
|---|---|
| Tool registry | Only approved read-only operations are exposed for execution. |
| Argument validation | Tool inputs are validated against the operation's expected schema. |
| Authorization | The authenticated user can access only permitted resources. |
| Execution boundary | Write-capable operations are rejected, even if requested or selected by the model. |
| Regression coverage | Attempts to send, create, modify, delete, or share external resources are tested. |
| Auditability | Relevant tool execution outcomes can be investigated without logging secrets. |
Important
Never run routine tests against personal or production accounts if they could send messages, change calendar events, modify tickets, share documents, or otherwise affect real resources. Mock prohibited operations and use dedicated test resources for authorized live checks.
6. Security testing¶
Security tests must target both individual services and the boundaries between them.
| Security area | Test focus |
|---|---|
| Authentication | Missing, malformed, expired, and invalid credentials |
| Authorization | Role enforcement, user isolation, and unauthorized resource access |
| API validation | Invalid payloads, unexpected fields, oversized inputs, and malformed requests |
| Integration credentials | Token protection, refresh failure handling, and secret redaction |
| Prompt injection | Malicious instructions in retrieved documents and provider content |
| Data isolation | Cross-user and cross-tenant access attempts, where applicable |
| Rate limiting | Enforcement of configured request limits and abuse controls |
| Error handling | No unintended disclosure of stack traces, secrets, or internal implementation details |
| Dependency security | Known vulnerabilities in dependencies and container images |
| Logging | Appropriate audit context without unnecessary sensitive data |
Caution
Security testing must use an authorized, isolated environment. Do not use real credentials or confidential production datasets in test fixtures, source control, or unprotected logs.
7. Test data and environment management¶
7.1 Test data requirements¶
- Prefer synthetic or appropriately anonymized datasets.
- Keep fixtures small, deterministic, and version-controlled where appropriate.
- Never commit access tokens, passwords, private keys, or production credentials.
- Avoid copying production records into local development environments.
- Reset mutable test state between test cases where necessary.
- Define retention and cleanup requirements for generated test artifacts.
7.2 Environment separation¶
| Environment | Purpose | Data and integration policy |
|---|---|---|
| Local development | Rapid feedback and debugging | Synthetic fixtures and mocks by default |
| CI | Repeatable automated validation | Isolated dependencies and no production credentials |
| Test/staging | Cross-service and release-candidate verification | Dedicated test accounts and controlled credentials |
| Production | Live operation and monitoring | No uncontrolled test mutations; any approved smoke tests must be explicitly safe |
8. Test execution and reporting¶
Tests should be runnable through documented, repeatable commands. The commands below are examples for a Python service using pytest; adapt them to the repository's actual test layout and installed dependencies.
Note
These commands are templates, not verified repository-specific commands. Confirm the actual test directories, dependency groups, service setup, and coverage configuration before incorporating them into CI.
8.1 Required test reporting¶
Test reports should capture:
- Commit or release identifier.
- Environment and relevant dependency versions.
- Test command and scope.
- Passed, failed, skipped, and blocked test counts.
- Coverage results when generated by a reproducible process.
- Security findings and unresolved high-risk defects.
- Relevant logs or artifacts, with sensitive values removed.
- Final acceptance decision and any approved exceptions.
Coverage percentages must be generated from actual test execution. Coverage alone does not establish correctness, completeness, or security.
9. Defect lifecycle¶
flowchart TD
A["Record defect"] --> B["Assess severity and impact"]
B --> C["Reproduce and investigate"]
C --> D["Implement corrective change"]
D --> E["Add regression test"]
E --> F["Run relevant test suites"]
F --> G{"Validation passed?"}
G -- "No" --> C
G -- "Yes" --> H["Review and document evidence"]
H --> I["Close defect or approve release"]
classDef work fill:#DCEBFA,stroke:#3975B7,color:#17365D,stroke-width:1.3px
classDef decision fill:#FCE8CF,stroke:#B7791F,color:#704214,stroke-width:1.3px
classDef done fill:#D9F2E6,stroke:#23835B,color:#174B37,stroke-width:1.3px
class A,B,C,D,E,F,H work
class G decision
class I done
Every defect should follow this process:
- Record the defect, impact, and reproduction steps.
- Assess severity, affected components, and security implications.
- Identify the root cause using source inspection and diagnostic evidence.
- Implement the smallest appropriate corrective change.
- Add or update a regression test.
- Run the relevant tests and assess related failure modes.
- Review the change and its test evidence.
- Document the outcome and close the defect only when acceptance criteria are met.
10. Release acceptance criteria¶
A release candidate should be evaluated against the following checklist. Items should be marked complete only when supporting evidence is available.
- Required unit, API, and integration tests pass.
- Critical user workflows have been validated.
- Security-sensitive authorization and isolation tests pass.
- Read-only integration restrictions have been verified.
- AI failure handling and untrusted-content scenarios have been tested.
- Database migrations and configuration have been validated.
- Required dependency and container security checks have been reviewed.
- Observability and error reporting are sufficient for investigation.
- Backup and rollback procedures have been reviewed and tested where required.
- Known defects and residual risks have documented dispositions.
- Test results and the release decision are recorded.
Danger
Do not release with an unresolved critical security vulnerability, a known authorization bypass, or a demonstrated path to prohibited external data modification. Any exception to other release requirements must be explicitly assessed, approved, and documented by the responsible authority.
11. Quality metrics¶
Use metrics to identify trends and areas for improvement rather than as standalone indicators of product quality.
| Metric | Purpose |
|---|---|
| Test pass rate | Tracks test-suite stability and release-candidate health. |
| Regression escape rate | Measures defects discovered after release that should have been caught earlier. |
| Defect resolution time | Helps identify investigation or remediation bottlenecks. |
| Coverage by critical component | Identifies untested code in high-risk areas. |
| AI task success rate | Measures task-specific model and orchestration quality against a defined evaluation set. |
| Tool-selection accuracy | Measures whether the appropriate tool is selected for supported requests. |
| Security test findings | Tracks vulnerabilities, remediation status, and residual risk. |
| Service latency and error rate | Evaluates operational performance against approved service objectives. |
Where numerical targets are required, establish explicit baselines and approved thresholds. Do not invent targets or report unmeasured values.
12. Continuous improvement¶
Review the strategy as WhiteLotusAI evolves. Update test coverage and acceptance criteria when introducing new services, integrations, AI workflows, security controls, or deployment mechanisms.
Use test failures, production incidents, security reviews, and defect trends to identify missing coverage. Prioritize improvements according to user impact, likelihood of failure, and potential security consequences.
Related documentation
- API endpoints and contracts
- API error handling
- Security overview
- Threat model
- Read-only integration security policy
- Deployment guide
Tip
Keep this strategy aligned with the actual repository test suite and CI pipeline. When adding a new critical workflow, define its expected behavior, negative cases, regression tests, and release evidence together.