-
Notifications
You must be signed in to change notification settings - Fork 0
18_Testing_Philosophy
BioPro is built on a foundation of Test-Driven Development (TDD) and SOLID principles. Because the application handles sensitive scientific data and executes third-party plugin code, our testing suite is divided into three critical layers: Unit, Integration, and Security.
As of the latest audit, the BioPro core library maintains a 59% overall coverage with 108 tests passing. High-risk modules (Communication, Security, Data Integrity) are prioritized with coverage exceeding 85%.
| Component | Coverage | Status |
|---|---|---|
| Event Bus (Nervous System) | 96% | β Robust |
| Diagnostics Engine | 94% | β Robust |
| Trust Architecture | 88% | β High |
| History Manager (Undo/Redo) | 86% | β High |
| Project & Asset Manager | 75% | β Target Met |
| Network & Plugin Updates | 65% | π― Targeting 80% |
| Resource Inspector | 51% | π― Targeting 80% |
| SBOM & Supply Chain | 0% | π― Targeting 90% |
Note
Coverage of 0% in modules like preferences.py or sign_plugin.py is intentional; these are either purely aesthetic UI panels or CLI wrappers that are verified via end-to-end integration tests rather than unit tests.
We use pytest-qt combined with an offscreen buffer to run UI tests without a physical display. This allows our CI/CD pipelines to verify signals, slots, and widget states.
# Run tests headlessly
QT_QPA_PLATFORM=offscreen .venv/bin/python3 -m pytest tests/core/Tests in test_trust_architecture.py verify that the application correctly rejects tampered plugins, unauthorized authors, and corrupted manifests. We use mocked keys to simulate "Project" vs "Developer" trust levels.
The HistoryManager is subjected to heavy stress tests to ensure that complex scientific states can be serialized, saved, and restored without data loss or memory leaks.
All developers are expected to run the suite locally before opening a Pull Request.
uv run pytestuv run pytest --cov=biopro/core --cov-report=term-missing-
Mock External IO: Use
monkeypatchorunittest.mockfor network requests and home directory access. -
Clean Teardown: Always use the
temp_config_dirfixture to avoid polluting your local~/.bioprofolder. -
Signal Tracking: Use
qtbot.waitSignalto verify asynchronous UI behavior.
We are currently executing an Acceleration Plan to move from 59% to 75% coverage by Q3 2026.
Priority Tracks:
-
Infrastructure Gaps: Closing missing logic paths in
module_manager.pyandnetwork_updater.py. -
Supply Chain Security: Achieving 90% coverage on the new
SBOMGeneratorandTrustManager. -
Memory Stability: Increasing coverage of the
ResourceInspectorto 80% to ensure large-dataset reliability.