Skip to main content

Logging & Reporting

Every ApiClient request is automatically logged in the step timeline:

[API] GET /api/users/1 → 200 (143ms)
[API] POST /api/orders → 201 (89ms)
[API] DELETE /api/orders/5 → 404 (12ms) ← logged as FAIL

Enable body and cURL logging in testfly.yml:

api:
logBody: true
logCurl: true

With logBody: true and logCurl: true enabled:

  • The HTML report renders requests with an expandable cURL snippet ready to copy-paste directly into your terminal or Postman.
  • Formatted request and response JSON payloads are highlighted in preformatted blocks inside the test's execution drawer.

Interceptor and retry reporting​

Every physical HTTP exchange is logged as INFO with an exchange number; retry decisions are WARN. The final logical response uses the existing PASS/FAIL status rule. Thus a recovered 401 followed by 200 does not create an intermediate FAIL step. Synthetic responses are marked [synthetic].

durationMs() measures the returned transport attempt (or supplied synthetic duration); the report also shows total logical-call time including retry/backoff. Header and cURL output use the actual sent request and case-insensitive masking, including Authorization, Cookie and X-Api-Key. Any header with a name word (split on -, _, camelCase) of key, token, auth, secret, signature, session, cookie, password or credential is masked too (X-Auth-Token yes, Author no), and so is the header name given to ApiAuth.apiKey(...) or the HMAC keyHeader, whatever it is called (X-Auth-Token=***). In a failing-assertion message the response body is shown masked and capped at 300 characters: values of sensitive JSON keys (and access_token, refresh_token, id_token) become "***", and in other text sensitive key=value pairs and JWT-like or long base64 runs are masked. ApiException.getBody() still returns the full body. OAuth2 token errors never include the response body: the message holds the masked token URL, the HTTP status and, when it is a valid RFC 6749 code, the error field. Request URLs are masked in the step log, the cURL line and exception messages: userinfo and the values of sensitive query parameters (api_key, token, ... plus api.maskedQueryParams) show as *** (see API Authentication). Enable cURL output explicitly with api.logCurl: true; masked commands require credentials to be supplied before replay.