Skip to main content

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​

TypeDescriptionExample
EqualsExact matchstatusCode == 200
Not EqualsValue must differerrorCode != 500
ContainsString or collection contains valuebody contains "success"
Not ContainsOpposite of Contains
Starts WithString prefix match
Ends WithString suffix match
JSON PathExtract and assert JSON field$.user.id equals 42
XPathExtract and assert XML field//Status/text() equals OK
Greater Than / Less ThanNumeric comparisonelapsed < 1000 ms
Is Null / Is Not NullNull-check
Regular ExpressionMatch against regex pattern
VariableCompare 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.

AssertionFails whenConfiguration
Schema Conformance AssertionThe response body does not match the structure the specification defines for the returned status codeNone — a status code the specification does not describe is reported, not failed
Contract Body AssertionThe response body differs from the body recorded in a contractThe 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:

CategoryScopeDescription
Operation-scopedA specific API operationMeasure a single endpoint's performance
Iteration-scopedThe entire test runMeasure overall test execution quality

Operation-Scoped Assertions​

AssertionMetricThreshold
Response TimeAverage response timeMaximum milliseconds
Nth PercentileP50, P95, P99, etc. response timePercentile value + maximum milliseconds
Service Pass RatePercentage of successful responsesMinimum pass percentage
Standard DeviationResponse time variabilityMaximum milliseconds
Time to First ByteAverage TTFBMaximum milliseconds
ThroughputRequests per secondMinimum req/s

Iteration-Scoped Assertions​

AssertionMetricThreshold
Iteration Pass RatePercentage of iterations with no failuresMinimum pass percentage
Ignored RateIgnored iteration count or rateMaximum count or percentage
Failed IterationsFailed iteration count or rateMaximum 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.

Next Steps​