Assertions
Assertions validate that an actual value matches an expected condition. An assertion failure marks the test case as Failed.
Where to Add Assertions
Assertions can be added:
- Inside a Send Request step – to validate the response of that specific request.
- As a standalone Assert step – to validate variables, mapped values, or any computed value.
Assertion Types
| Type | Description | Example |
|---|---|---|
| Equals | Exact match | statusCode == 200 |
| Not Equals | Value must differ | errorCode != 500 |
| Contains | String or collection contains value | body contains "success" |
| Not Contains | Opposite of Contains | |
| Starts With | String prefix match | |
| Ends With | String suffix match | |
| JSON Path | Extract and assert JSON field | $.user.id equals 42 |
| XPath | Extract and assert XML field | //Status/text() equals OK |
| Greater Than / Less Than | Numeric comparison | elapsed < 1000 ms |
| Is Null / Is Not Null | Null-check | |
| Regular Expression | Match against regex pattern | |
| Variable | Compare two variables | {responseToken} == {expectedToken} |
Asserting HTTP Response Fields
In a Send Request step's Assertions section, you can directly assert:
- Status Code – e.g.,
200,201,400 - Response Time (ms) – performance threshold
- Response Header – specific header value
- Response Body – via JSON Path, XPath, or Contains
:::info Screenshot needed — light/dark 📸
assertions-panel-light.png and assertions-panel-dark.png — Assertions panel inside Send Request step with several assertions configured
:::
Specification-Based Assertions
Two assertions compare the response against the imported API specification instead of a value you type in yourself. They are available on a Send Request step and need no expected value.
| Assertion | Fails when | Configuration |
|---|---|---|
| Schema Conformance Assertion | The response body does not match the structure the specification defines for the returned status code | None — a status code the specification does not describe is reported, not failed |
| Contract Body Assertion | The response body differs from the body recorded in a contract | The recorded body (JSON is compared member by member, other content types literally) |
Field-level violations are listed in the step diagnostics, for example
Pet.Name: required field is null or Items[2].Price: 12 is below minimum 18, so the failure names
the field that broke rather than only the response.
Use the Schema Conformance assertion when you want a test case to keep tracking the specification, so
an undocumented change to a response fails the step that consumes it. Use the Contract Body assertion
when the exact recorded response is the requirement — the provider side of contract verification
adds it automatically at the exact strictness level.
Tips
- Add an assertion for the HTTP status code on every request step.
- Use JSON Path assertions (
$.field) for REST APIs and XPath (//Element) for SOAP. - Give each assertion a meaningful name for easy diagnosis in reports.
Load Test Assertions
Load test assertions evaluate aggregate performance metrics over the entire load test run — distinct from step-level assertions that check individual HTTP responses. They are added under the Assertions tab of a load test case or suite.
Load test assertions fall into two categories:
| Category | Scope | Description |
|---|---|---|
| Operation-scoped | A specific API operation | Measure a single endpoint's performance |
| Iteration-scoped | The entire test run | Measure overall test execution quality |
Operation-Scoped Assertions
| Assertion | Metric | Threshold |
|---|---|---|
| Response Time | Average response time | Maximum milliseconds |
| Nth Percentile | P50, P95, P99, etc. response time | Percentile value + maximum milliseconds |
| Service Pass Rate | Percentage of successful responses | Minimum pass percentage |
| Standard Deviation | Response time variability | Maximum milliseconds |
| Time to First Byte | Average TTFB | Maximum milliseconds |
| Throughput | Requests per second | Minimum req/s |
Iteration-Scoped Assertions
| Assertion | Metric | Threshold |
|---|---|---|
| Iteration Pass Rate | Percentage of iterations with no failures | Minimum pass percentage |
| Ignored Rate | Ignored iteration count or rate | Maximum count or percentage |
| Failed Iterations | Failed iteration count or rate | Maximum count or percentage |
Ignored Rate and Failed Iterations support both absolute (count) and percentage threshold modes.
Editing Load Test Assertions
Load test assertions are edited via the unified Edit Load Assertion dialog. Select an assertion type to reveal its specific fields (percentile value for Nth Percentile, min req/s for Throughput, etc.).
See Load & Performance Testing for the full load testing workflow.