Mock can simulate the background response of an http interface, and can simulate request and response
Download moco-runner-0.11.0-standalone.jar
Download link: https://pan.baidu.com/s/1bmFzvJPRnDlQ-cmuJ_3iRg Extraction code: kpjv
Make sure jdk is installed, and java -version can be run under cmd
1. Simulate a get request without parameters
#The description line in the code can not be written; the general structure is description, request, response, except for description, other values are in the form of key-value pairs; request defines uri (interface address), method (request method), queries or forms;
Reference Code:
[
{
"description":"this is a no param get",
"request":{
"uri":"/get",
"method":"Get"
},
"response":{
"text":"Yeah,you sucess"
}
}
]
2. Simulate a get request with parameters;
Parameters use "queries"
3. Send Post without parameters;
Post requests cannot be accessed using a browser, you can use Postman or Jmeter tools;
The browser access results are as follows:
Postman settings and results are as follows:
Jmeter settings and results are as follows:
4. Send a Post request with parameters; the parameters use "forms"
Postman settings and results are shown in the figure below; the key value (key, value) is passed correctly, the status will display 200, otherwise it will display 400;
The jmeter settings and results are shown in the figure below;
[A full 200 episodes] A collection of super-detailed advanced tutorials for automated testing of Python interfaces, a real simulation of actual enterprise project combat