Codex Test — Test Engineering & Benchmarking Skill
The verification and quality assurance engine of AI Codex. Ensures software correctness through rigorous unit, integration, property-based, and benchmark test suites.
Overview
codex-test applies disciplined test engineering across all layers of the testing pyramid. Rather than writing superficial tests, it targets boundary conditions, malicious payloads, concurrency race hazards, and performance degradation. It outputs timestamped test reports and test plan walkthroughs into codex-drive/walkthroughs/.
When to Trigger
- User runs
/codex-test(e.g.,/codex-test write unit tests for payment engine,/codex-test add integration tests with Testcontainers,/codex-test benchmark JSON serialization throughput) - Writing tests for a newly implemented feature or refactored component
- Setting up CI/CD test automation or establishing code coverage thresholds
Execution Workflow
┌────────────────────────────────────────────────────────┐
│ 1. ANALYZE SYSTEM CONTRACTS & FAILURE MODES │
│ Map inputs, outputs, invariants, and edge cases. │
└──────────────────────────┬─────────────────────────────┘
│
▼
┌────────────────────────────────────────────────────────┐
│ 2. DESIGN TESTING PYRAMID MATRIX │
│ Unit tests, integration tests, E2E & benchmarks. │
└──────────────────────────┬─────────────────────────────┘
│
▼
┌────────────────────────────────────────────────────────┐
│ 3. IMPLEMENT TEST SUITES & ISOLATED HARNESSES │
│ Mock dependencies, seed test data, property tests. │
└──────────────────────────┬─────────────────────────────┘
│
▼
┌────────────────────────────────────────────────────────┐
│ 4. EXECUTE & MEASURE (COVERAGE & PERFORMANCE) │
│ Run tests, measure execution time, check coverage. │
└──────────────────────────┬─────────────────────────────┘
│
▼
┌────────────────────────────────────────────────────────┐
│ 5. WRITE VERIFICATION REPORT IN CODEX-DRIVE │
│ Write codex-drive/walkthroughs/YYYY-MM-DD-*.test.md │
└────────────────────────────────────────────────────────┘
Test Walkthrough Specification (codex-drive/walkthroughs/)
All testing reports generated by codex-test MUST be Markdown (.md) files with exact date-time metadata.
Filename Format:
codex-drive/walkthroughs/YYYY-MM-DD-<slug>.test.md
Standard Test Execution Report Template:
# [Component / Feature Name] Test Engineering & Verification Report
> **Created At**: YYYY-MM-DD HH:MM:SS (Local Time)
> **Active Codex Edition**: [`skills/codex/<edition>/`](file:///...)
> **Test Framework**: [e.g., Vitest / Jest / pytest / cargo test / xUnit / Swift Testing]
> **Total Test Count**: [e.g., 42 passed, 0 failed, 0 skipped]
> **Execution Duration**: [e.g., 1.42s]
---
## 1. Test Strategy & Scope Matrix
| Test Layer | Target Component | Coverage Focus | Tooling / Harness |
| :--- | :--- | :--- | :--- |
| **Unit** | `OrderCalculator` | Rounding, tax boundaries, empty arrays | Standard Test Runner |
| **Property-Based** | `CurrencyParser` | Fuzzing random Unicode, extreme values | `fast-check` / `proptest` / `Hypothesis` |
| **Integration** | `OrderRepository` | DB transactions, rollback integrity | Testcontainers (PostgreSQL) |
| **Benchmark** | `OrderSerializer` | Throughput (MB/s), allocations (B/op) | BenchmarkDotNet / Criterion / pytest-benchmark |
## 2. Edge Cases & Boundary Conditions Tested
- [x] **Zero / Negative Inputs**: Verified rejection of negative order quantities.
- [x] **Null / Missing Attributes**: Handled missing optional metadata gracefully.
- [x] **Concurrency & Race Conditions**: Executed 100 concurrent requests without data corruption.
- [x] **Network Disruption**: Verified exponential backoff and timeout handling.
## 3. Test Code Implementation
```typescript
describe("OrderCalculator", () => {
it("should calculate exact tax without IEEE 754 floating point drift", () => {
const result = calculateTotal({ subtotal: 19.99, taxRate: 0.0825 });
expect(result.total).toBe(21.64);
});
});
4. Execution Results & Coverage Metrics
- Line Coverage: 98.4%
- Branch Coverage: 95.1%
- All Invariants Verified: YES
5. Continuous Integration (CI) Command
npm run test:coverage
---
## Response Protocol
When `codex-test` finishes:
1. Provide a direct link to `[View Test Report](file:///.../codex-drive/walkthroughs/YYYY-MM-DD-<slug>.test.md)`.
2. Summarize the number of tests added and edge cases covered.
3. Provide the exact command line to run the test suite locally.