Module test_casing::decorators

source ·
Expand description

Test decorator trait and implementations.

§Overview

A test decorator takes a tested function and calls it zero or more times, perhaps with additional logic spliced between calls. Examples of decorators include retries, Timeouts and test Sequences.

Decorators are composable: DecorateTest is automatically implemented for a tuple with 2..=8 elements where each element implements DecorateTest. The decorators in a tuple are applied in the order of their appearance in the tuple.

§Examples

See decorate macro docs for the examples of usage.

Structs§

  • Test decorator that retries a wrapped test the specified number of times, potentially with a delay between retries.
  • Test decorator that retries a wrapped test a certain number of times only if an error matches the specified predicate.
  • Test decorator that makes runs of decorated tests sequential. The sequence can optionally be aborted if a test in it fails.
  • Test decorator that fails a wrapped test if it doesn’t complete in the specified Duration.

Traits§