Parameterize across environments
Medium70 pts
- Environment configuration
- Portability
Practice app · Acme REST API
A live REST + GraphQL API with auth, validation, pagination, rate limiting and an interactive request console.
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
- 1Create an environment map, e.g. { dev: BASE_URL, staging: BASE_URL } using admin credentials { "username": "qa@target.dev", "password": "Test@123" }.
- 2Select the environment from an environment variable (e.g. TEST_ENV), defaulting to dev.
- 3POST {env} + "/auth/token", extract access_token, then GET {env} + "/auth/me" with Authorization: Bearer <access_token> → assert 200 and role "admin".
Validation Checks
- 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 Practice Track · Data-driven & parameterization