Testing¶
HoloConf uses a multi-layered testing strategy to ensure correctness across all language bindings.
Test Layers¶
| Layer | Purpose | Location |
|---|---|---|
| Unit tests | Test individual components | crates/*/src/, packages/*/tests/ |
| Acceptance tests | Cross-language behavior verification | tests/acceptance/ |
| Integration tests | End-to-end scenarios | tests/integration/ |
Running Tests¶
All Tests¶
Rust Unit Tests¶
Python Unit Tests¶
Acceptance Tests¶
# Run with Rust driver
python tools/test_runner.py --driver rust 'tests/acceptance/**/*.yaml' -v
# Run with Python driver
python tools/test_runner.py --driver python 'tests/acceptance/**/*.yaml' -v
# Run a specific test file
python tools/test_runner.py --driver python tests/acceptance/resolvers/env.yaml -v
See Acceptance Tests for test format details and the full test matrix.
Writing Good Tests¶
Do¶
- Test one behavior per test case
- Use descriptive test names
- Cover both success and error cases
- Test edge cases and boundaries
- Keep test data minimal but realistic
Don't¶
- Don't test implementation details
- Don't rely on external services
- Don't use random/time-dependent data
- Don't write overly complex test configs
Debugging Tests¶
Verbose Output¶
Run Single Test¶
Debug in Python¶
from holoconf import Config
config = Config.from_string("""
database:
host: ${env:DB_HOST,default=localhost}
""")
# Inspect values
print(config.dump(resolve=True))
Code Coverage¶
Coverage Goals¶
| Package | Target | Notes |
|---|---|---|
| holoconf-core (Rust) | 80% | Core logic, all public APIs |
| holoconf (Python) | 80% | Bindings and Python-specific code |
| holoconf-cli | 70% | CLI commands and argument handling |
Generating Coverage Reports¶
Rust Coverage¶
# Generate HTML coverage report
make coverage-rust
# View report
open target/llvm-cov/html/index.html
Requires cargo-llvm-cov:
Python Coverage¶
Full Coverage (Rust + Python + Acceptance)¶
This generates a combined report covering:
- Rust unit tests
- Python unit tests
- Acceptance tests run through both drivers
Coverage in CI¶
Coverage reports are automatically generated on pull requests. The CI will:
- Run all test suites with coverage instrumentation
- Generate combined coverage reports
- Post coverage summary as a PR comment
- Fail if coverage drops below thresholds
See Also¶
- Acceptance Tests - Cross-language acceptance test details
- ADR-013 Testing Architecture - Design rationale for the testing approach