Why need mock requests
- Instead of waiting for the dependent web service to develop and deploy, you just need to define the interface fields and the front back end can be developed in parallel.
- Some web service may contaminate the data in the production environment, while the real request will not be sent by simulating the request and specifying the response you want.
- Many times, the web service may return various types of responses, and developers and testers need to verify if it is working correctly under different returns, for example, when web service status code is 500, the page can be displayed as expected. Creating the data through normal operations can sometimes be particularly cumbersome or difficult, while using mock requests is convenient, and boundary testing can be done efficiently if you want to return what you want.
- It is the base of TDD (test-driven development) and automated testing.