Skip to content

πŸ§ͺ 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
TEST_CASE("Integration - Full Pipeline - Clean Architecture")

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
TEST_CASE("Integration - Full Pipeline - With Violations")

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
TEST_CASE("Integration - Build Order and Metrics Alignment")

Checks: - Build order respects hierarchy levels - Metrics complexity correlates with build complexity - Max depth ≀ build stages + 2

Pattern Library + Anti-Patterns
TEST_CASE("Integration - Pattern Library and Anti-Patterns Mutual Exclusivity")

Validation: - Clean architecture: patterns detected, no anti-patterns - Violated architecture: anti-patterns detected, fewer patterns - Mutual exclusivity verified

Metrics History + Enforcement
TEST_CASE("Integration - Metrics History Tracks Enforcement Impact")

Scenario: - Iteration 1: Architecture with violations β†’ Low health - Iteration 2: Fix violations β†’ Improved health - Verify trend is improving

Cross-Component Consistency
TEST_CASE("Integration - Cross-Component Consistency Checks")

Consistency Checks: - Rule violations match anti-pattern count - Metrics reflect validation state - Pattern library health = metrics quality score

Exemption Workflow
TEST_CASE("Integration - Complete Exemption Workflow")

Lifecycle: 1. Request exemption (PENDING) 2. Approve exemption (APPROVED) 3. Verify active 4. Revoke exemption (REVOKED) 5. Verify inactive

Performance
TEST_CASE("Integration - Performance of Full Pipeline")

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
TEST_CASE("Integration - Complete 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
TEST_CASE("Interop - Dependency Graph Shared Across Components")

Validation: - Graph built once, used by multiple components - Graph properties consistent across uses - No rebuilds required

RuleEngine + AntiPatternDetector Alignment
TEST_CASE("Interop - RuleEngine and AntiPatternDetector Alignment")

Checks: - Both detect same upward dependency violations - Both agree on clean architecture - Violation IDs consistent

BuildOrder Statistics Match Metrics
TEST_CASE("Interop - BuildOrder Statistics Match Metrics")

Consistency: - Module counts match - Dependency counts match - Statistics aligned

PatternLibrary Health Matches Metrics Quality
TEST_CASE("Interop - PatternLibrary Health Matches Metrics Quality")

Validation: - Architecture health scores identical - Pattern counts consistent - Quality metrics aligned

Enforcement Results Reflected in Metrics
TEST_CASE("Interop - Enforcement Results Reflected in Metrics")

Correlation: - Passed enforcement β†’ High metrics - Failed enforcement β†’ Low metrics - Health scores correlated

Exemptions Integrate with Enforcement
TEST_CASE("Interop - Exemptions Integrate with Enforcement")

Workflow: - Without exemption β†’ Enforcement fails - With approved exemption β†’ Tracking works - Exemption lifecycle validated

Metrics History Tracks System Evolution
TEST_CASE("Interop - Metrics History Tracks System Evolution")

Tracking: - Growth over 3 snapshots - Module counts increase - Trend calculation works

Complete Data Flow
TEST_CASE("Interop - Complete Data Flow Across All Components")

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
TEST_CASE("Interop - Data Format Conversions")

Formats: - JSON export - CSV export - Report export - All valid and parseable

Error Handling
TEST_CASE("Interop - Consistent Error Handling")

Scenario: Circular dependency

Detected by: - βœ… DependencyGraph - βœ… AntiPatternDetector - βœ… MetricsCollector


πŸ§ͺ Running Tests

Build Tests

cd build
cmake -DBUILD_TESTING=ON ..
make test_full_pipeline test_interoperability

Run All Integration Tests

ctest -R "test_full_pipeline|test_interoperability" --output-on-failure

Run Specific Suite

# Full pipeline tests only
./tests/test_full_pipeline

# Interoperability tests only
./tests/test_interoperability

Run with Verbose Output

./tests/test_full_pipeline -s
./tests/test_interoperability -s

Run Specific Test Case

./tests/test_full_pipeline "[integration][pipeline]"
./tests/test_interoperability "[interop][graph]"

Custom Target

make integration_tests

πŸ“Š 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

// In test file
#define CATCH_CONFIG_ENABLE_BENCHMARKING

Run with Debugger

gdb ./tests/test_full_pipeline
(gdb) run "[integration][pipeline]"

Check Specific Component

// In test
std::cout << snapshot.to_report() << "\n";
std::cout << "Antipatterns: " << antipatterns.size() << "\n";

Performance Profiling

valgrind --tool=callgrind ./tests/test_full_pipeline
kcachegrind callgrind.out.*

πŸ› Common Issues

Issue: Tests fail with "Component not found"

Solution: Ensure all component libraries are built:

cmake --build . --target all

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:

cmake -DCMAKE_BUILD_TYPE=Release ..


πŸ“– See Also


πŸ“œ License

Part of the AudioLab project.


Last Updated: 2025-10-10 Maintainer: AudioLab Core Team Status: βœ… Production Ready