Skip to main content

Module testing_framework

Module testing_framework 

Source
Expand description

§Stream Testing Framework

This module provides a comprehensive testing framework for stream applications, enabling developers to write reliable and maintainable tests.

§Features

  • Test harness for stream applications
  • Mock streams and event generators
  • Time manipulation for testing windows
  • Assertions for stream output
  • Performance testing utilities
  • Test fixtures and builders
  • Test report generation

§Example

use oxirs_stream::testing_framework::*;

#[tokio::test]
async fn test_stream_processing() {
    let harness = TestHarness::builder()
        .with_mock_clock()
        .with_event_generator(EventGenerator::sequential(100))
        .build()
        .await?;

    harness.push_events(vec![/* events */]).await;
    harness.advance_time(Duration::from_secs(60)).await;

    assert_stream_output!(harness, contains(expected));
}

Structs§

Assertion
Assertion for testing
CapturedEvent
Captured event with metadata
EventGenerator
Event generator for creating test events
EventMatcher
Event matcher for assertions
GeneratorConfig
Generator configuration
MockClock
Mock clock for time manipulation in tests
TestFixture
Test fixture for common test scenarios
TestHarness
Test harness for stream testing
TestHarnessBuilder
Test harness builder
TestHarnessConfig
Configuration for the test harness
TestMetrics
Test metrics
TestReport
Test report

Enums§

AssertionType
Assertion types
GeneratorType
Types of event generators
PerformanceMetric
Performance metrics
TestStatus
Test status