Assert Preconditions #
Assert preconditions are a set of conditions, which must be fulfilled before executing asserts for a participant. Preconditions not only give more flexibility and control over the assertion process but also provide advanced monitoring capabilities, making results more accurate.
Use of preconditions #
Assert preconditions can be configured while creating or editing the test - to use preconditions add them from predefined list to the existing assert. The following properties can be used to define assert preconditions:
Precondition chaining #
To apply multiple preconditions to the same asserts, they can be chained to
apply all conditions at the same time. By default, multiple preconditions on the
same assert are chained using logical AND operator.
For example, if assert should be executed only when participant location is not
equal to ap-east-1
AND browser is the latest version of Mozilla Firefox:
Path | Precondition | Operator | Expected |
---|---|---|---|
machine/cpu/max | browser == firefoxLatest location != ap-east-1 | > | 20 |
Chaining with OR
To implement chaining with logical OR operator, it is necessary to create
duplicate asserts with appropriate preconditions.
For example, if assert should be executed only when participant location is not
ap-east-1
OR browser is the latest version of Mozilla Firefox:
Path | Precondition | Operator | Expected |
---|---|---|---|
machine/cpu/max | browser == firefoxLatest | > | 20 |
machine/cpu/max | location != ap-east-1 | > | 20 |
Be careful chaining multiple preconditions from the same property field, e.g., Browser, in many cases can be contradicting.
For example, chaining two preconditions with browser properties and using AND operator will result in skipped assert.
Path Precondition Operator Expected machine/cpu/max
browser == firefoxLatest
browser == chrome79
> 20