Testing Strategy
Testing ensures correctness across consensus logic, cryptography, and the web wallet. We rely on layered techniques outlined below.
Unit and integration tests
tests/test_blockchain.py,tests/test_transaction.py, and related modules validate core blockchain behaviors (mining rewards, transaction validation).- Wallet integration tests exercise Flask routes using test clients.
Property-based testing
tests/test_transaction_props.pyuses Hypothesis to probe invariant properties of transaction creation and validation, catching corner cases beyond hand-written tests.
Concurrency testing
tests/test_ots_concurrency.pystresses XMSS signing under concurrent threads to verify the locking around OTS index management.
API fuzzing
tests/test_api_fuzz.pygenerates randomized requests against wallet endpoints to ensure robust input validation and stable responses.
Coverage and reporting
- Pytest runs with
--cov=qrl --cov-report=xmlin CI. Codecov ingests the XML report to track trends over time. Local developers can runmake testto mirror the workflow.
Continuous audit pipeline
- GitHub Actions executes pip-audit and bandit in the
security-auditjob (seepytest.yml). - Trivy scans both the repository filesystem and Docker image for vulnerabilities; SARIF results surface in GitHub code scanning alerts.
- CodeQL analyzes Python sources for security issues on every push and pull request.
Developer workflow tips
- Install
pre-commithooks viamake lintto run Ruff and mypy before committing. - Use the Makefile to regenerate lockfiles (
make lock), execute tests, or serve docs locally. - Run targeted pytest suites when modifying sensitive modules (e.g., cryptography or networking) to minimize regression risk.