mock
moco-runner下载地址:
https://repo1.maven.org/maven2/com/github/dreamhead/moco-runner/1.2.0/
1、moco-runner使用前提条件:jdk必须安装
2、启动moco-runner服务命令:
启动http服务
java -jar <path-to-moco-runner> http -p <monitor-port> -c < configuration -file>
<path-to-moco-runner>:moco-runner-0.11.0-standalone.jar包的路径
<monitor-port>:http服务监听的端口
<configuration -file>:配置文件路径
例如:java -jar moco-runner-1.2.0-standalone.jar http -p 82 -c config.json
启动https是服务:
java -jar moco-runner-0.10.0-standalone.jar https -p 82 -c config.json
3、moco-runner 常用属性
属性 说明
method 请求方式,包含:get、post、delete、head等
headers 请求头信息
json json格式的数据,可以在请求和响应中
uri 请求路径
text 文本域,一般用于返回
queries 请求入参
forms 表单
cookies
xpaths
json_paths
version
file 调用的文件
path_resource
redirectTo 重定向到某个地址
4、接口信息配置到json文件中,json文件中的接口配置信息严格遵守字典格式。注意:标点符号后不能有空格