Why is mocking useful in API testing?
- A. To reduce testing time by skipping tests
- B. To simulate API behavior when the actual API is unavailable
- C. To make real API calls more efficient
- D. To test the UI directly
What is the difference between a stub and a spy in API testing?
- A. A stub mimics behavior, while a spy tracks API call details
- B. A spy mocks data, while a stub makes real API calls
- C. A stub logs API calls, while a spy modifies the responses
- D. A stub tests performance, while a spy tests security
Which of the following is NOT a tool mentioned for API mocking?
- A. Mockito
- B. WireMock
- C. Postman
- D. Playwright
What does Playwright’s built-in mocking feature allow you to do?
- A. Perform API load testing
- B. Intercept, modify, and block network requests during test execution
- C. Automatically generate API documentation
- D. Increase the speed of real API calls
What is a key benefit of using Playwright’s mocking feature in API testing?
- A. It replaces real API calls with predefined responses, ensuring faster and more reliable tests
- B. It allows direct access to the backend API during tests
- C. It automatically validates API security
- D. It requires setting up an external server to mock requests