Hurl
Today, in a project, I wanted to set up a few smoke tests to verify that my http api worked in production. hurl came to the rescue, a simple and straightforward text-based tool (and text does run the world!).
Here's a sample of my tests file (generated handily by claude):
# --- Auth ---
# Reject missing auth
GET {{api_url}}/osrm/route/v1/driving/-74.172400,40.735700;-74.027600,40.744000
HTTP 401
# Reject invalid key
GET {{api_url}}/osrm/route/v1/driving/-74.172400,40.735700;-74.027600,40.744000
Authorization: Bearer 00000000-0000-0000-0000-000000000000
HTTP 401
# --- OSRM Route ---
# Basic route request
GET {{api_url}}/osrm/route/v1/driving/-74.172400,40.735700;-74.027600,40.744000
Authorization: Bearer {{api_key}}
HTTP 200
[Asserts]
header "Content-Type" contains "application/json"
jsonpath "$.code" == "Ok"
Hurl supports variables, which makes running against different servers (local / prod) a breeze. I configured the variables in my .env which get auto-populated in my shell by direnv:
## dev
HURL_VARIABLE_api_key=asdf
HURL_VARIABLE_api_url=http://localhost:8000
Note that environment variables are prefixed with HURL_VARIABLE_<name>, and interpolated in the hurl file with just <name>.
To run the tests:
$ hurl tests/smoke.hurl --test --error-format long
This will print a summary of the test results, bailing on error with the failing response.
Browsing the docs, hurl can be used as just an http automation tool, or in test mode as above, and also as a load/stress test tool with the --repeat <count> option.
I found hurl to fit the niche in between manual tests and unit tests.