前言
在自动化用例中,我们经常会看到有人提问,上一个接口的返回的结果,如何取出来给到下个接口的入参。
我们用 extract 关键字提取接口的返回结果(需要更新v1.0.2版本)。
extract 关键字使用
举个例子
用个post请求http://httpbin.org/post
POST http://httpbin.org/post HTTP/1.1
User-Agent: Fiddler
Host: httpbin.org
Content-Length: 0
HTTP/1.1 200 OK
Date: Thu, 24 Nov 2022 06:18:03 GMT
Content-Type: application/json
Content-Length: 320
Connection: keep-alive
Server: gunicorn/19.9.0
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
{
"args": {},
"data": "",
"files": {},
"form": {},
"headers": {
"Content-Length": "0",
"Host": "httpbin.org",
"User-Agent": "Fiddler",
"X-Amzn-Trace-Id": "Root=1-637f0c9a-23b419f4180f6b843ba941af"
},
"json": null,
"origin":