API API Performance Testing 2 — Questions and Answers
Question 1: What is the purpose of a 'spike test' in API performance testing?
- Test the API with a steady gradual ramp-up
- Test how the API handles a sudden large burst of traffic (Correct answer)
- Validate API security under load
- Measure API response correctness at scale
Correct answer: Test how the API handles a sudden large burst of traffic
Spike testing sends a sudden, massive increase in load to see whether the API can recover and handle abrupt traffic surges.
Question 2: Which metric measures the percentage of API requests that fail during a performance test?
- Latency
- Throughput
- Error rate (Correct answer)
- Concurrency
Correct answer: Error rate
Error rate is the percentage of total requests that return error responses (4xx or 5xx) during a performance test run.
Question 3: What does 'virtual users' (VUs) mean in the context of API performance tools like k6?
- Simulated concurrent clients sending API requests (Correct answer)
- Real users monitored during a test
- Test scripts written in JavaScript
- API endpoints under test
Correct answer: Simulated concurrent clients sending API requests
Virtual users (VUs) are simulated concurrent clients that each follow a test script, allowing testers to model realistic multi-user load.
Question 4: Which modern performance testing tool uses JavaScript-based scripts and is popular for CI/CD integration?
- JMeter
- Gatling
- k6 (Correct answer)
- LoadRunner
Correct answer: k6
k6 by Grafana Labs uses JavaScript test scripts and is designed for developer-friendly, CI/CD-integrated performance testing.
Question 5: What is the significance of setting a 'think time' in API performance test scripts?
- Pausing the test runner between waves
- Simulating realistic user delays between consecutive requests (Correct answer)
- Setting a timeout for assertions
- Delaying server startup during tests
Correct answer: Simulating realistic user delays between consecutive requests
Think time simulates the natural pause a real user takes between actions, making load patterns more realistic and avoiding artificial request bursts.
Question 6: What does the Apdex score measure in API performance monitoring?
- The number of API endpoints available
- User satisfaction based on response time thresholds (Correct answer)
- The API's uptime percentage
- The number of concurrent connections
Correct answer: User satisfaction based on response time thresholds
Apdex (Application Performance Index) is a standardized score from 0–1 measuring user satisfaction by bucketing response times into Satisfied, Tolerating, and Frustrated.
What is the purpose of a 'spike test' in API performance testing?