HTTP Execution
Send an HTTP request to a service and capture the response. This is the most common test type — you call an API endpoint and check what comes back.
execution:
executor: http
target: http://api:8080
request:
method: POST
url: /api/users
headers:
Content-Type: application/json
body: '{"email": "test@example.com", "name": "Test User"}'
Fields
| Field | Required | Description |
|---|---|---|
executor | no | Set to http (default when request is present) |
target | yes | Base URL — use the service name as hostname (e.g., http://api:8080) |
request.method | yes | HTTP method (GET, POST, PUT, DELETE, etc.) |
request.url | yes | URL path (e.g., /api/users) |
request.headers | no | Map of request headers |
request.body | no | Request body as string |
Available assertions
HTTP tests can use:
statusCode— check the HTTP status codesnapshot— compare the response body against a saved file (artifact:responseBody)
Full example
Here's a complete test with services, setup, execution, and assertions:
- name: Create user returns 201
tags: [smoke, api]
services:
- name: api
image: myapp:latest
healthcheck:
test: "curl -f http://localhost:8080/health"
retries: 30
- name: db
image: postgres:15
environment:
POSTGRES_DB: test
POSTGRES_PASSWORD: secret
healthcheck:
test: "pg_isready"
retries: 30
setup:
- http:
target: http://api:8080
request:
method: POST
url: /seed
execution:
executor: http
target: http://api:8080
request:
method: POST
url: /api/users
headers:
Content-Type: application/json
body: '{"email": "test@example.com", "name": "Test User"}'
assertions:
- statusCode:
equals: 201