Raxol.Test.Performance.Assertions (Raxol v0.2.0)

View Source

Provides assertions for performance testing of Raxol components.

This module includes assertions for:

  • Render time thresholds
  • Memory usage limits
  • Event latency requirements
  • Resource utilization bounds

Summary

Functions

Asserts that event handling latency stays within acceptable bounds.

Asserts that a component's memory usage stays within specified limits.

Asserts that a component's performance hasn't regressed from baseline.

Asserts that a component's performance metrics meet all requirements.

Asserts that a component renders within a specified time limit.

Asserts that a component's resource utilization remains stable.

Functions

assert_event_latency(component, event, opts \\ [])

Asserts that event handling latency stays within acceptable bounds.

Example

assert_event_latency component, :click, under: 10 # milliseconds

assert_memory_usage(component, operation, opts \\ [])

Asserts that a component's memory usage stays within specified limits.

Example

assert_memory_usage component, fn ->
  render_with_large_dataset(component)
end, under: 1024 * 1024 # 1MB

assert_no_performance_regression(component, baseline_name)

Asserts that a component's performance hasn't regressed from baseline.

Example

assert_no_performance_regression component, "button_baseline"

assert_performance_requirements(component, requirements)

Asserts that a component's performance metrics meet all requirements.

Example

assert_performance_requirements component, %{
  render_time: 100,
  memory_usage: 1024 * 1024,
  event_latency: 10
}

assert_render_time(component, operation, opts \\ [])

Asserts that a component renders within a specified time limit.

Example

assert_render_time component, fn ->
  render_iterations(component, 1000)
end, under: 100 # milliseconds

assert_stable_resource_usage(component, opts \\ [])

Asserts that a component's resource utilization remains stable.

Example

assert_stable_resource_usage component, duration: 1000