π§ͺ Integration Tests¶
Complete Integration Testing for AudioLab Hierarchy Framework
Part of the AudioLab Hierarchy Framework (05_01_test_integration).
π― Overview¶
This test suite validates the end-to-end integration of all Hierarchy Framework components working together. While individual components have their own unit tests (>85% coverage each), these integration tests ensure they work correctly as a unified system.
Test Coverage: - β Full pipeline workflows (clean & violated architectures) - β Cross-component data consistency - β Interoperability between subsystems - β Performance of integrated pipeline - β Error handling across boundaries - β Data format conversions
ποΈ Test Architecture¶
Test Suites¶
05_01_test_integration/
βββ test_full_pipeline.cpp # End-to-end workflows
βββ test_interoperability.cpp # Component interactions
Component Integration Map¶
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β INTEGRATION TESTS β
β β
β ββββββββββββββ ββββββββββββββ ββββββββββββββ β
β β Pipeline β β Interop β β Performanceβ β
β β Tests β β Tests β β Tests β β
β βββββββ¬βββββββ βββββββ¬βββββββ βββββββ¬βββββββ β
β β β β β
β ββββββββββββββββββ΄βββββββββββββββββ β
β β β
βββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββ΄ββββββββββββββββββ
β β
βββββββββΌβββββββββ ββββββββββΌβββββββββ
β Level Defs β β Validation β
β Comp Rules β β Anti-Patterns β
β Pattern Lib ββββββββββββββββββΊβ Build Order β
β Enforcement β β Metrics β
β Exemptions β β Reporting β
ββββββββββββββββββ βββββββββββββββββββ
π Test Suites¶
1. Full Pipeline Tests (test_full_pipeline.cpp)¶
Tests complete workflows from architecture definition through metrics reporting.
Test Scenarios¶
Clean Architecture Pipeline¶
Steps Tested: 1. β Validate composition rules β No violations 2. β Build dependency graph β No cycles 3. β Detect anti-patterns β None found 4. β Detect good patterns β Layered architecture detected 5. β Calculate build order β Valid topological sort 6. β Enforcement check (strict) β Passes 7. β Collect metrics β Health score β₯ 80 8. β Full pipeline integration β All components agree
Architecture Used: - 10 L0 modules (DSP kernels) - 8 L1 modules (DSP atoms) - 4 L2 modules (DSP cells) - 2 L3 modules (Plugin engines) - Total: 25 modules with realistic dependencies
Violated Architecture Pipeline¶
Violations Injected: - β οΈ Upward dependency: L0 β L1 - β οΈ Horizontal dependency: L1 β L1 - β οΈ Circular dependency: L2 β L1
Verification: - Composition rules detect violations - Anti-patterns detected β₯ 3 - Enforcement blocks violations - Metrics show degradation - Exemption system can override
Build Order + Metrics Alignment¶
Checks: - Build order respects hierarchy levels - Metrics complexity correlates with build complexity - Max depth β€ build stages + 2
Pattern Library + Anti-Patterns¶
Validation: - Clean architecture: patterns detected, no anti-patterns - Violated architecture: anti-patterns detected, fewer patterns - Mutual exclusivity verified
Metrics History + Enforcement¶
Scenario: - Iteration 1: Architecture with violations β Low health - Iteration 2: Fix violations β Improved health - Verify trend is improving
Cross-Component Consistency¶
Consistency Checks: - Rule violations match anti-pattern count - Metrics reflect validation state - Pattern library health = metrics quality score
Exemption Workflow¶
Lifecycle: 1. Request exemption (PENDING) 2. Approve exemption (APPROVED) 3. Verify active 4. Revoke exemption (REVOKED) 5. Verify inactive
Performance¶
Target: Full pipeline < 200ms for 25 modules
Pipeline Steps: - Rule validation - Graph construction - Anti-pattern detection - Pattern detection - Build order calculation - Metrics collection
Reporting Pipeline¶
Formats Validated: - Summary report - Detailed report - JSON export - HTML dashboard - Badge markdown
2. Interoperability Tests (test_interoperability.cpp)¶
Tests component interactions and data sharing.
Test Scenarios¶
Dependency Graph Sharing¶
Validation: - Graph built once, used by multiple components - Graph properties consistent across uses - No rebuilds required
RuleEngine + AntiPatternDetector Alignment¶
Checks: - Both detect same upward dependency violations - Both agree on clean architecture - Violation IDs consistent
BuildOrder Statistics Match Metrics¶
Consistency: - Module counts match - Dependency counts match - Statistics aligned
PatternLibrary Health Matches Metrics Quality¶
Validation: - Architecture health scores identical - Pattern counts consistent - Quality metrics aligned
Enforcement Results Reflected in Metrics¶
Correlation: - Passed enforcement β High metrics - Failed enforcement β Low metrics - Health scores correlated
Exemptions Integrate with Enforcement¶
Workflow: - Without exemption β Enforcement fails - With approved exemption β Tracking works - Exemption lifecycle validated
Metrics History Tracks System Evolution¶
Tracking: - Growth over 3 snapshots - Module counts increase - Trend calculation works
Complete Data Flow¶
7-Step Flow: 1. Validate rules 2. Build graph 3. Detect patterns 4. Detect anti-patterns 5. Calculate build order 6. Collect metrics 7. Enforce policy
All components agree on clean state
Format Conversions¶
Formats: - JSON export - CSV export - Report export - All valid and parseable
Error Handling¶
Scenario: Circular dependency
Detected by: - β DependencyGraph - β AntiPatternDetector - β MetricsCollector
π§ͺ Running Tests¶
Build Tests¶
Run All Integration Tests¶
Run Specific Suite¶
# Full pipeline tests only
./tests/test_full_pipeline
# Interoperability tests only
./tests/test_interoperability
Run with Verbose Output¶
Run Specific Test Case¶
./tests/test_full_pipeline "[integration][pipeline]"
./tests/test_interoperability "[interop][graph]"
Custom Target¶
π Test Statistics¶
Coverage¶
| Component | Unit Tests | Integration Tests | Total Coverage |
|---|---|---|---|
| Level Definitions | 20 tests | 5 scenarios | >90% |
| Composition Rules | 30 tests | 8 scenarios | >90% |
| Validation Engine | 40 tests | 10 scenarios | >90% |
| Anti-Patterns | 35 tests | 12 scenarios | >90% |
| Pattern Library | 40 tests | 10 scenarios | >90% |
| Build Order | 30 tests | 6 scenarios | >85% |
| Enforcement | 25 tests | 8 scenarios | >85% |
| Exemptions | 20 tests | 4 scenarios | >85% |
| Metrics | 45 tests | 12 scenarios | >85% |
| Integration | - | 75 scenarios | Full E2E |
Test Counts¶
- Full Pipeline Tests: 8 test cases
- Interoperability Tests: 12 test cases
- Total Integration Tests: 20 test cases
- Total Assertions: 200+ assertions
Performance Targets¶
- Full pipeline (25 modules): < 200ms
- Graph construction: < 20ms
- Anti-pattern detection: < 50ms
- Pattern detection: < 50ms
- Build order calculation: < 30ms
- Metrics collection: < 50ms
π― Test Data¶
Realistic DSP Architecture¶
Used in full pipeline tests:
Hierarchy:
L3 (2 modules)
βββ PluginHost
βββ SynthPlugin
β
L2 (4 modules)
βββ SynthEngine
βββ EffectsProcessor
βββ VoiceManager
βββ PresetManager
β
L1 (8 modules)
βββ SynthVoice
βββ LFO
βββ NoiseGenerator
βββ FilterBank
βββ EnvelopeGenerator
βββ ModulationMatrix
βββ OscillatorMixer
βββ EffectsChain
β
L0 (10 modules)
βββ SineOscillator
βββ SawOscillator
βββ SquareOscillator
βββ LowPassFilter
βββ HighPassFilter
βββ BandPassFilter
βββ ADSREnvelope
βββ AREnvelope
βββ WhiteNoise
βββ PinkNoise
Statistics: - Total modules: 24 - Total dependencies: ~40 - Max depth: 4 - Clean architecture (no violations)
π Debugging Integration Tests¶
Enable Verbose Logging¶
Run with Debugger¶
Check Specific Component¶
// In test
std::cout << snapshot.to_report() << "\n";
std::cout << "Antipatterns: " << antipatterns.size() << "\n";
Performance Profiling¶
π Common Issues¶
Issue: Tests fail with "Component not found"¶
Solution: Ensure all component libraries are built:
Issue: Catch2 not found¶
Solution: Install Catch2:
# vcpkg
vcpkg install catch2
# Or set CMAKE_PREFIX_PATH
cmake -DCMAKE_PREFIX_PATH=/path/to/catch2 ..
Issue: Linker errors¶
Solution: Check library order in CMakeLists.txt. Dependencies must be listed in correct order.
Issue: Performance targets not met¶
Solution: Build in Release mode:
π See Also¶
- Validation Engine - Dependency validation
- Pattern Library - Good patterns
- Anti-Patterns - Anti-pattern detection
- Metrics Collector - Quality metrics
π License¶
Part of the AudioLab project.
Last Updated: 2025-10-10 Maintainer: AudioLab Core Team Status: β Production Ready