Practice & Assessment
Test your understanding of Authentication and Testing
Multiple Choice Questions
6What is the correct Authorization header format for Bearer token authentication?
Which pm object method is used to define a named test assertion in Postman?
What does pm.response.json() return?
Which approach is recommended for applying the same authentication to all requests in a collection?
A test script needs to check that the response body contains an 'id' field that is a number. Which code is correct?
What Chai assertion checks that an array has at least 5 items?
Mini Project
API Test Suite with Full Authentication Flow
Build a production-style API test suite for the GoREST API (gorest.co.in) which requires API key authentication. Register for a free API key at gorest.co.in. Create a collection 'GoREST API Tests' with a Development environment storing your base_url and api_key. Set collection-level auth to API Key with key 'Authorization' and value 'Bearer {{api_key}}'. Build tests for: GET /public/v2/users (list users, verify array, check count), POST /public/v2/users (create user with random email using {{$randomEmail}}, save returned id), GET /public/v2/users/{{user_id}} (verify exact user data), PATCH /public/v2/users/{{user_id}} (update name, verify change), DELETE /public/v2/users/{{user_id}} (verify 204), GET /public/v2/users/{{user_id}} (verify 404). Every request must have 3+ test assertions. Run with Collection Runner and achieve 100% pass rate.
