Testing Strategy
Testing strategy for MetaForge Phase 1 (v0.1–0.3). Covers the test pyramid, naming conventions, tooling, and per-module coverage expectations.
Testing Taxonomy
MetaForge uses a 12-level testing taxonomy. Each level answers a different question about system correctness.
| Level | Name | Description | Tooling (MetaForge) | Status |
|---|---|---|---|---|
| 1 | Static Analysis / Linting | Syntax errors, type issues, code smells | ruff check ., mypy --strict | Covered |
| 2 | Unit Tests | Individual functions in isolation | pytest tests/unit/ (1607 tests) | Covered |
| 3 | Component Tests | Single module/node in isolation, no cross-module wiring | pytest tests/unit/ with InMemoryTwinAPI, InMemoryMcpBridge | Partial |
| 4 | Contract Tests | API/message schema agreements between services | No dedicated tooling yet — Pydantic schemas act as implicit contracts | Gap |
| 5 | Integration Tests | Multiple real components wired together | pytest tests/integration/ (49 tests) | Partial |
| 6 | Smoke Tests | Does it start and respond at all? | tests/integration/test_gateway_smoke.py, manual uvicorn check | Covered |
| 7 | Regression Tests | Did new changes break existing behaviour? | Full pytest suite run in CI on every PR | Covered (implicit) |
| 8 | E2E / System Tests | Full pipeline start to finish | pytest tests/e2e/ (98 tests, full vertical per agent) | Covered |
| 9 | Performance / Load Tests | Throughput, latency under load | Not implemented | Gap |
| 10 | Security Tests | Injection, auth, data exposure | Not implemented | Gap |
| 11 | Acceptance Tests (UAT) | Meets requirements, user sign-off | Not implemented | Gap |
| 12 | Chaos / Resilience Tests | Behaviour when things fail | Not implemented | Gap |
Component vs. Unit distinction: Tests under tests/unit/ use InMemoryTwinAPI and InMemoryMcpBridge as in-memory doubles, not mocks. Any test that wires a real McpClient or real TwinAPI to an agent is classified as Component (Level 3). Any test that wires two or more real modules is Integration (Level 5).
Regression (Level 7) is implicit: MetaForge does not maintain a separate regression test directory. The full pytest suite acts as the regression gate on every PR via CI.
Tooling
| Tool | Purpose |
|---|---|
| pytest | Test runner (async mode via pytest-asyncio, mode=AUTO) |
| pytest-asyncio | Async test support — all agent/skill tests are async |
| pydantic | Schema validation in tests (same models as production) |
| InMemoryTwinAPI | In-memory Digital Twin for deterministic tests |
| InMemoryMcpBridge | In-memory MCP bridge with pre-registered tool responses |
| LoopbackTransport | Full MCP protocol stack without network (server ↔ client) |
| httpx (ASGI) | Gateway HTTP tests via ASGITransport (no real network) |
| ruff | Linting |
| mypy | Type checking |