Module test

Source
Expand description

This provides testing functionality for building tests.

Feature: test (disabled by default)

If the sentry crate has been compiled with the test support feature this module becomes available and provides functionality to capture events in a block.

§Example usage

use sentry::test::with_captured_events;
use sentry::{capture_message, Level};

let events = with_captured_events(|| {
    capture_message("Hello World!", Level::Warning);
});
assert_eq!(events.len(), 1);
assert_eq!(events[0].message.as_ref().unwrap(), "Hello World!");

Structs§

TestTransport
Collects events instead of sending them.

Functions§

with_captured_envelopes
Runs some code with the default test hub and returns the captured envelopes.
with_captured_envelopes_options
Runs some code with the default test hub with the given options and returns the captured envelopes.
with_captured_events
Runs some code with the default test hub and returns the captured events.
with_captured_events_options
Runs some code with the default test hub with the given options and returns the captured events.