Skip to main content

Module assert

Module assert 

Source
Expand description

The assert module enables defining test properties about your program or workload.

The constant LOCAL_OUTPUT is associated with local logging, which is one of the local execution modes.

Each macro/function in this module takes a parameter called message, which is a string literal identifier used to aggregate assertions. Antithesis generates one test property per unique message This test property will be named message in the triage report.

Each macro/function also takes a parameter called details, which is a key-value map of optional additional information provided by the user to add context for assertion failures. The information that is logged will appear in the logs section of a triage report. Normally the values in details are evaluated at runtime. Details may be borrowed structs or maps implementing serde::Serialize; serialization happens only when an assertion evaluation is emitted. Constructing the details argument still happens on every call, so json! at the call site is not deferred. Omitted details and values that serialize to null are omitted from the event; explicit empty objects are preserved. Other JSON values are wrapped in an object under "value", for example 3 becomes {"value": 3}. Serialization errors emit an antithesis_error message and omit details without suppressing the assertion. Declarations never include details.

Structs§

TrackingInfo

Enums§

AssertType

Functions§

assert_raw
This is a low-level method designed to be used by third-party frameworks. Regular users of the assert package should not call it.