Testing Guide
This guide documents test workflows for contributors and maintainers.
Prerequisites
- Python 3.11+ environment
- Editable install with dev dependencies
python -m venv .venv
.venv/Scripts/activate
pip install -e .[dev]
Test Suite Layout
Main test folders and focus areas:
tests/test_parser_*.py: parser behavior and fallback pathstests/test_pass_contracts.py: pass interface and contract stabilitytests/test_parallel_scoring.py: process-pool and scoring behaviortests/test_topn_optimization.py: TopN optimization and ranking invariantstests/test_scanresult_schema_validation.py: schema contract checkstests/test_runmanifest.py: runmanifest integrity and verificationtests/regression_testing/: real/synthetic sample inputs for regression coverage
Recommended Test Commands
Full suite
pytest tests/ -v
Fast contract-focused subset
pytest tests/test_pass_contracts.py tests/test_parser_smoke.py tests/test_scanresult_schema_validation.py -v
RunManifest and auditability checks
pytest tests/test_runmanifest.py -v
Parser fallback edge-case checks
pytest tests/test_openvas_parser_fallbacks.py tests/test_openvas_port_protocol_fallbacks.py tests/test_openvas_title_description_fallbacks.py -v
Large-Input and Performance Validation
For performance-sensitive changes, include at least one scaled or stress validation run using available generators under tests/.
Examples:
tests/generate_5k_nessus.pytests/generate_50k_nessus.pytests/generate_700k_nessus.py
When executing large workloads, use reduced logging verbosity and document hardware context with results.
Test Expectations for Changes
Parser changes
- Keep detection confidence and parser-selection behavior consistent.
- Add/update fallback tests for affected fields.
- Validate no regression on representative real-world samples.
Pass and scoring changes
- Preserve deterministic ranking behavior.
- Keep pass output contracts stable, or version/document changes.
- Confirm parallel and sequential paths both remain valid.
Schema or output changes
- Update schema artifacts where needed.
- Update schema validation tests.
- Update usage/output documentation in same PR.
RunManifest changes
- Keep integrity verification behavior stable.
- Validate schema and hash-chain checks.
- Test compact and expanded mode implications.
PR Verification Checklist
- Run focused tests for changed modules.
- Run full suite before merge for non-trivial changes.
- Include exact commands run in PR description.
- Include key pass/fail evidence when fixing regressions.