Automation Testing API Test Automation 1 — Questions and Answers
Question 1: Which HTTP status code indicates a successful API request that returned data?
- 200 OK (Correct answer)
- 201 Created
- 204 No Content
- 301 Moved Permanently
Correct answer: 200 OK
HTTP 200 OK is the standard response for a successful GET request that returns the requested data.
Question 2: What is REST in the context of API testing?
- Representational State Transfer — an architectural style for distributed hypermedia systems (Correct answer)
- A testing methodology
- A programming language
- A database query language
Correct answer: Representational State Transfer — an architectural style for distributed hypermedia systems
REST (Representational State Transfer) is an architectural style using standard HTTP methods for stateless client-server communication.
Question 3: Which tool is most commonly used in the US for manual and automated API testing with a GUI?
- Postman (Correct answer)
- SoapUI
- Insomnia
- curl
Correct answer: Postman
Postman is the most widely adopted API testing platform in the US, offering both manual testing and automated collection runners.
Question 4: What does the REST API verb PUT do?
- Replaces an entire resource with the provided data (Correct answer)
- Creates a new resource
- Retrieves a resource
- Partially updates a resource
Correct answer: Replaces an entire resource with the provided data
PUT replaces the entire target resource with the request payload, while PATCH makes partial updates.
Question 5: In API testing, what is a JSON schema used for?
- Validating the structure and data types of an API response (Correct answer)
- Storing API credentials
- Generating API requests
- Documenting API endpoints
Correct answer: Validating the structure and data types of an API response
JSON Schema defines the expected structure, required fields, and data types of a JSON response, enabling automated response validation.
Question 6: What is the purpose of an API authentication header like Authorization: Bearer <token>?
- To provide credentials proving the caller is allowed to access the API resource (Correct answer)
- To specify the response format
- To set the request content type
- To enable CORS
Correct answer: To provide credentials proving the caller is allowed to access the API resource
The Authorization Bearer token header carries a JWT or OAuth access token that the server verifies to authenticate and authorize the request.
Which HTTP status code indicates a successful API request that returned data?