API Testing Interview
API Testing Interview
1. What is an API?
API stands for Application Programming Interface is a set of rules and protocols that allows different
software applications to communicate with each other. It defines how systems exchange data while
keeping their internal code hidden.
For example, a weather app uses an API to fetch weather updates from a server.
6. What are the most commonly used tools for API testing?
- Postman
- SoapUI
- Newman
- Requests
- Swagger
7. What are the differences between API Testing and Unit Testing?
API testing is typically handled by the QA team, while unit testing is handled by the
development team.
API testing is a black box testing approach, focusing on functionality, while unit testing is white
box testing, focusing on internal code logic.
API testing verifies the full functionality of the system as it will be used by external developers,
whereas unit testing checks if individual code units work as expected in isolation.
API testers do not have access to the source code, whereas developers performing unit testing
have access to the source code.
8. What is SOAP?
SOAP is a protocol for exchanging messages in web services. It uses XML for formatting and typically works
over HTTP or SMTP. It's platform-independent and ensures secure communication between systems.
REST:
1. REST is an architectural style for designing network-based services.
2. REST supports multiple data formats (XML, JSON, etc.).
3. REST supports caching and is faster than SOAP.
4. REST works like a browser, using standard HTTP methods (GET, POST, etc.).
5. REST uses HTTP headers to store meta information.
- Accuracy of data
- Schema validation
- HTTP status codes
- Data types, validations, order, and completeness
- Authorization checks
- Response timeout handling
- Error codes returned by the API
- Non-functional testing, such as performance and security testing
13. What are the principles of API test design?
- Setup – Prepare test data and start necessary services.
- Execution – Run the API call and log the process.
- Verification – Check if the response is correct.
- Reporting – Mark the test as pass, fail, or blocked.
- Clean up – Restore the system to its original state.
Status Code – Indicates the result Exp- 200, 301, 404, 500 (these are the most common ones)
Headers – Contain metadata like content type and cache control.
Body (optional) – Holds the response data (e.g., JSON, XML, HTML).
22. What are API documentation templates that are commonly used?
- Swagger/OpenAPI
- RAML
- API Blueprint
- WSDL
- Postman Collections
- RestDoc
25. What are some common authentication methods used in API testing?
Common authentication methods in API testing include:
API Key – A unique key sent in headers or query parameters.
Basic Authentication – Uses a username and password encoded in Base64.
Bearer Token – Uses tokens like JWT for secure authentication.
OAuth 2.0 – A more secure method using access tokens.
Digest Authentication – Encrypts credentials before sending.
HMAC (Hash-based Message Authentication Code) – Uses a secret key to sign requests.
27. What are the differences between API Testing and UI Testing?
API enables communication between software systems by providing functions that another system can
execute.
UI Testing focuses on testing graphical elements like fonts, images, layouts, and user interactions to ensure
a smooth user experience.
30. How do you test API performance, and which tools do you use?
API performance is tested by evaluating its speed, scalability, and resource usage under various conditions.
Response Time: Measure how quickly the API responds to requests.
Throughput: Test how many requests the API can handle within a given time frame.
Stress Testing: Simulate high traffic to see how the API performs under stress.
Load Testing: Check how the API performs under normal and peak load conditions.
Scalability: Test how well the API scales with an increasing number of requests.
Tools used:
JMeter – For load and stress testing.
Postman – For basic performance testing and response time tracking.
LoadRunner – For large-scale performance testing.
Gatling – For high-performance load testing.