Testing Guide
QBITEL Bridge uses a multi-layered testing strategy covering unit, integration, end-to-end, performance, and security testing across all four language stacks.
Testing Strategy
| Level | Scope | Tools |
|---|---|---|
| Unit | Individual functions and classes | pytest, cargo test, go test, Vitest |
| Integration | Component interactions | pytest, httpx, testcontainers |
| End-to-End | Full system workflows | pytest, custom e2e framework |
| Performance | Throughput, latency, load | pytest-benchmark, k6, Locust |
| Security | Vulnerability scanning | Bandit, cargo audit, OWASP ZAP |
| Chaos | Resilience under failure | Custom chaos experiments |
Running All Tests
# Run the complete test suite across all components
make test Python Tests (pytest)
# Run all Python tests
pytest ai_engine/tests/ -v
# Run with coverage
pytest ai_engine/tests/ --cov=ai_engine --cov-report=html
# Run specific test categories
pytest ai_engine/tests/test_api.py -v # API tests
pytest ai_engine/tests/test_protocol_discovery.py -v # Discovery tests
pytest ai_engine/tests/test_compliance.py -v # Compliance tests
pytest ai_engine/tests/test_auth.py -v # Auth tests
# Run performance benchmarks
pytest ai_engine/tests/performance/test_benchmarks.py -v --benchmark-only
# Run only fast unit tests
pytest ai_engine/tests/ -v -m "not integration and not slow" Test Fixtures
Shared fixtures are defined in ai_engine/tests/conftest.py. Key fixtures include database sessions, mock LLM providers, and test traffic data.
Rust Tests (cargo test)
cd rust/dataplane
# Run all tests
cargo test
# Run tests for a specific crate
cargo test -p pqc_tls
cargo test -p dpi_engine
# Run with output visible
cargo test -- --nocapture
# Run integration tests
cargo test --test integration Go Tests (go test)
# Run control plane tests
cd go/controlplane && go test ./...
# Run management API tests
cd go/mgmtapi && go test ./...
# Run with coverage
go test -cover ./...
# Run specific test
go test -run TestPolicyBundles ./internal/policy/ Frontend Tests
cd ui/console
# Run test suite
npm test
# Run with coverage
npm test -- --coverage Integration Tests
Integration tests verify interactions between components and require running services:
# Run Python integration tests
pytest tests/integration/ -v
# Run e2e flow tests
pytest tests/integration/test_uc1_e2e_flow.py -v
# Run with Docker services
./tests/integration/run_integration_tests.sh Load and Performance Tests
# Run k6 load tests
k6 run tests/load/k6-load-test.js
# Run Locust load tests
locust -f tests/load/locustfile.py --host http://localhost:8000
# Run comprehensive load test
python tests/load/comprehensive_load_test.py Chaos Engineering
Chaos experiments validate system resilience under failure conditions:
# Run chaos experiments (Kubernetes required)
kubectl apply -f tests/chaos/chaos-experiments.yaml CI/CD Integration
Tests run automatically in the CI/CD pipeline defined in .github/workflows/. The pipeline runs unit tests on every pull request and integration tests on merge to main.
Next Steps
- Production Checklist -- verify performance targets
- Monitoring -- set up test result dashboards
- Compliance Frameworks -- compliance testing requirements