Loading

Write Scout API tests

Scout API tests validate HTTP endpoints with realistic scoped credentials.

  1. Prepare with higher-privilege helpers (apiServices, kbnClient, esArchiver, …)
  2. Authenticate with requestAuth (or samlAuth for internal/*)
  3. Call the endpoint under test with apiClient + the scoped headers
  4. Assert status + response body, and verify side effects when needed

See best practices for API tests.

Example test (Console).

API tests live under <plugin-root>/test/scout/api/tests and must end with .spec.ts.