mocorunner构建mock测试服务器

编程

这个下载有些慢,可以网盘获取:

链接:https://pan.baidu.com/s/1PzwGCcrWNwdn6R2Cpr11Xw 密码:t8rk

简单运行

java -jar moco-runner-0.12.0-standalone.jar http -p 9090 -c foo.json

foo.json

[

{

"response": {

"text": "foo"

}

}

]

Post

JSON配置文件

[

{

"request": {

"text": "foo"

},

"response": {

"text": "bar"

}

},

{

"request": {

"uri": "/json",

"text": {

"json": "{"foo":"bar"}"

}

},

"response": {

"text": "foo"

}

}

]

请求一:

POST http://localhost:9090/json  

Accept: */*

Cache-Control: no-cache

{"foo":"bar"}

响应一:

POST http://localhost:9090/json

HTTP/1.1 200 OK

Content-Length: 3

Content-Type: text/plain; charset=utf-8

foo

请求二:

GET http://localhost:9090  

Accept: */*

Cache-Control: no-cache

foo

响应二:

GET http://localhost:9090

HTTP/1.1 200 OK

Content-Length: 3

Content-Type: text/plain; charset=utf-8

bar

更多用法参考

以上是 mocorunner构建mock测试服务器 的全部内容, 来源链接: utcz.com/z/513339.html

回到顶部