Tests
Tests let HTTPBot check a response for you automatically. Every time you tap Send, HTTPBot runs the request's tests against the response and reports which ones passed and which failed — so you can confirm an endpoint behaves the way you expect without eyeballing the output each time.
Results appear on the Tests tab of the response screen, with the actual value shown next to each assertion. See Viewing Responses.
You can add as many tests to a request as you need.



Adding a test
- Open the request
…menu and choose Tests. - Tap + to add a test.
- Choose a Test Type — what part of the response to look at.
- Choose a Comparator — how to compare it.
- Enter the expected value (when the comparator needs one).
- Save. The test now runs after every send.
You can edit or delete a test later from the same Tests list.



Test types
| Test Type | What it checks |
|---|---|
| Status Code | The HTTP status code (e.g. 200) |
| Response Time | How long the request took, in ms or s |
| Response Size | The response size, in bytes, KB, or MB |
| Response Body | The raw response body text |
| Header | A single header, selected by name |
| Headers | The whole set of response headers (a list) |
| Cookie | A single cookie, selected by name |
| Cookies | The whole set of response cookies (a list) |
| JSON Path | A value extracted from JSON via a JSONPath expression |
| JQ | A value extracted from JSON via a jq filter expression (e.g. .user.id) |
| XPath | A value extracted from XML/HTML via an XPath expression |
For the Header and Cookie types you specify the name to look up. For JSON Path, JQ, and XPath you provide the path or filter expression that selects the value to test.
Server-Sent Events tests
When a response is a Server-Sent Events (SSE) stream, you can assert on the events it delivers:
| Test Type | What it checks |
|---|---|
| SSE Event Count | How many events arrived |
| SSE Event Data | The data payload of an event |
| SSE Event Name | The event: name of an event |
| SSE Event JSON Path | A JSONPath value inside an event's data |
The data, name, and JSON Path SSE tests include an event selector that picks which event to look at: First, Last, By Index (you enter the index), By Name (you enter the event name), or Any. See Server-Sent Events for more on streaming responses.
Comparators
The comparators available depend on the test type. They fall into a few groups.
Equality and ordering (numeric types such as Status Code, Response Time, Response Size, and SSE Event Count):
is/is notis greater than/is less thanis greater than or equal to/is less than or equal tois between— you enter a min and max
Text matching (Response Body, Header, Cookie, JSON Path, JQ, XPath, and the SSE data/name tests):
is/is notcontains/does not containbegins with/ends withmatches regex/does not match regexexists/does not existhas any value/does not have any value
List checks (the Headers and Cookies list types):
is empty/is not emptycontains key/does not contain key— you enter the key namecount is— you enter the expected number of items
Case sensitivity
Text-based tests (Response Body, Header, Cookie, JSON Path, JQ, XPath, and the
SSE data/name/JSON Path tests) offer a Case-Sensitive toggle so you can decide
whether OK and ok should be treated as equal. For the Headers and Cookies
list types, the toggle applies when you're checking for a specific key.
Examples
- Status Code
is200— confirm the request succeeded. - Response Time
is less than500ms — guard against slow endpoints. - JSON Path
$.data.idexists— confirm a field is present in the JSON. - JQ
.user.idis42— confirm a JSON field has the expected value. - Header
Content-Typecontainsapplication/json— confirm the response is JSON. - Cookies
contains keysession— confirm a session cookie was set.
Reusing tests with the Test Library
If you've written a test you want to use again, you don't have to recreate it.
From the test editor's … menu, choose Select Existing Test to open the
Test Library and pick a test you've created before. HTTPBot copies its type,
comparator, and expected value into the test you're editing, which you can then
tweak and save.


