官网:
https://github.com/dreamhead/mocohttps://github.com/dreamhead/moco
更多使用文档:
https://github.com/dreamhead/moco/blob/master/moco-doc/usage.mdhttps://github.com/dreamhead/moco/blob/master/moco-doc/usage.md这里直接下载
Quick Start
将 moco-runner-1.3.0-standalone.jar 下载文件放到本地目录,然后编写login.json文件 ?
[
{
"description" :"带参数的post请求,返回json",
"request" :
{
"uri" : "/login",
"method" : "post",
"forms" : {
"uname" : "aaa",
"pwd" : "111"
}
},
"response" :
{
"status":200,
"json":{
"code": 0,
"loginTime": "2022-2-21 14:49",
"message": "登录成功!",
"result": {
"addr": "127.0.0.1"
}
}
}
},
{
"description":"带header请求",
"request": {
"uri": "/withHeader",
"method": "post",
"headers": {
"content-type": "application/json"
},
"json": {
"name": "xiaoming",
"age": "18"
}
},
"response":{
"json":{
"message":"success",
"status":"1"
}
}
},
{
"description":"带参数的get请求,p1,p2分别的参数1,参数2,名称可随便起,个数也可随便加",
"request":{
"uri":"/wihtGetDemobyParam",
"method":"get",
"queries":{
"p1":"hh",
"p2":"good"
}
},
"response":{
"json":{
"message":"success 成功!",
"status":"1"
}
}
}
]
cd到此目录执行命令启动
?java -jar moco-runner-1.3.0-standalone.jar http -p 12306 -c login.json
postman请求测试一下,是否ok
?
?
ok,成功了,收工~?
?
|