In the mobile development process, due to inconsistencies in the front and back end, waiting for background development ready, often affect the work progress, and, even if the background API in place, because in the project development phase, the interface is often unstable, but also add and subtract fields and other issues. At this time, the mobile developers will need a flexible configuration of the simulation server request response tools to match their own mobile request package, there are many mock tools, such as Mock-server, Api Faker, Apimocker, etc. Some things are based on Nodejs, some are based on Java, need to deploy in the appropriate environment, more trouble, SOUPUI is a desktop testing tool, easy to install, powerful, can meet the needs of the mobile developers backstage request response requirements, this time only describes the RESTful API request response settings, He also has other functions, such as background interface test, WebService interface test, and so on, with time to be introduced in detail.
First download SOAPUI, official address: https://www.soapui.org/downloads/soapui.html,
Install the same as other Windows programs, start soapui after installation;
Right-click Projects, select New REST Project, set the requested Uri,ip, ports, resources, methods can be customized, here I set the local IP, Port is 8087;
The resulting project is as follows, we can add parameters to the request, click the plus sign, enter name and value:
Right-click on the IP and port, select the Generate REST Mock service, give the new mock service a name, click OK to generate the simulation services, the original project request has been inherited, only the new service port becomes 8089:
Double-click Response 1, write the corresponding data, pay attention to choose the correct data type, this time with the JSON:
Start the service and then you can test it:
The results are as follows, indicating that the test was successful, and the test was also successful with the mobile browser, thus implementing the request response simulation of the API service.