我们有个业务需求A,需要调三个Http接口(h1,h2,h3)完成,其中h3请求需要拿h2的返回值的某个key的值,这里我实现了一个很方便的自动化工具,下面看怎么利用工具配置实现这个流程。
{
"env": ["腾讯云", "Docker"],
"env-domain": ["腾讯云接口域名", "Docker接口域名"],
"env-login-url": [
"腾讯云环境登录url",
"Docker环境登录url"
],
"env-login-account": [
{"accounts": "腾讯云环境账号", "password": "腾讯云环境密码"},
{"accounts": "Docker环境账号", "password": "Docker环境密码"}
],
"func": [{
"desc": "新增子活动完整流程-小佳维护",
"events":[
{
"alias":"AAA",
"method": "/lyadmin/parentActivity/insert.json",
"body":"$file{新增主活动.yml}",
"page-input": [
{"name": "主活动开始时间:", "key": "activityStartTime", "def-val": "2019-11-28 17:36:00"},
{"name": "主活动结束时间:", "key": "activityEndTime", "def-val": "2019-11-28 18:36:00"}
]
},{
"alias":"BBB",
"method": "/lyadmin/parentActivity/selectActivityManagerList",
"body":"$file{查询主活动.yml}",
"page-input": []
},{
"alias":"CCC",
"method": "/lyadmin/childActivity/insert.json",
"body":"$file{新增子活动.yml}",
"ref-input":[
{"ref":"BBB.['data']['datas'][0]['id']","in-key":"['parentActivityId']"}
]
}
]
}]
}
这里我截图了一个例子,里面 $#{ python代码块}#$ 可用用来调用python代码来生成结果,进行参数替换。