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

FieldRequiredDescription
executornoSet to http (default when request is present)
targetyesBase URL — use the service name as hostname (e.g., http://api:8080)
request.methodyesHTTP method (GET, POST, PUT, DELETE, etc.)
request.urlyesURL path (e.g., /api/users)
request.headersnoMap of request headers
request.bodynoRequest body as string

Available assertions

HTTP tests can use:

  • statusCode — check the HTTP status code
  • snapshot — 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