Assertions
Assertions validate that step outputs match expected values. They catch regressions early and document the expected behaviour of your system.Basic Syntax
Each assertion rule specifies a path to target, an operator, and an expected value.Assertion Operators
JSONPath in Assertions
Assertions use the same JSONPath syntax as extraction:Variables in Expected Values
Expected values can reference state variables:Assertions on Different Step Types
HTTP
Shell
Database
Ignoring Assertion Failures
Combine withignore_error to allow optional assertions:
How Assertions Work
- The step executes and produces a result value
- The assertion engine resolves
{{ variables }}in expected values - If a
pathis specified, it resolves the JSONPath against the result - The operator compares the resolved value against the expected value
- If the comparison fails, the step is marked as failed (unless
ignore_error)
"5" == 5 evaluates to true.
What’s Next?
- Transform data with templating and functions
- Deep-dive into working with JSON