API testing

Parameterize across environments

Medium70 pts~25 min
  • Environment configuration
  • Portability
Practice app · Acme REST API

A live REST + GraphQL API with auth, validation, pagination, rate limiting and an interactive request console.

BASE_URL
/api/practice
Console app
/lab/api-testing-parameterize-across-environments

Your starter code already declares BASE_URL — call the API relative to it.

Objective

Resolve the base URL and credentials from an environment name so the same test runs anywhere.

Your task

  1. 1Create an environment map, e.g. { dev: BASE_URL, staging: BASE_URL } with the admin fixture per environment.
  2. 2Select the environment from an environment variable (e.g. TEST_ENV), defaulting to dev.
  3. 3POST {env}/auth/token, then GET {env}/auth/me with the token → assert 200 and role "admin".

Acceptance criteria

  • POST /auth/token returns 200
  • GET /auth/me returns 200
  • Configuration is read from the environment
  • At least 2 assertions pass

Fixtures

apiKey
tqa_live_key_123
basicUser
admin
basicPassword
secret
username
qa@target.dev
password
Test@123

API testing · API Testing · Data-driven & parameterization