安装
- JDK 1.8+ (推荐1.8版本)
- 下载 moco-runner-1.1.0-standalone.jar
使用
- 在 moco-runner-1.1.0-standalone.jar 同一个目录里新建一个 json 文件,如:test.json;
- 在 test.json 文件中构建接口的请求和返回信息:
[{ "description": "moco 快速开始示例", "request": { "method":"post", "uri": "/account", "headers":{ "Content-Type": "application/json" }, "json":{ "user_id": 123456, "account_type": 1, "param3":3, "param4":4, "param5":5 } }, "response": { "json":{ "status": 100000, "msg": "success", "data":"This is the content details." } } }]
- dos 窗口切换到该目录,运行
java -jar moco-runner-1.1.0-standalone.jar http -p 9999 -c test.json
- 打开 postman,测试该接口,可以正常调用: