引言
我们在上一篇文章介绍如何在测试用例的响应数据的某个参数值,然后传递到依赖下一个测试步骤;
在实际项目中的测试用例难免会遇到传入多组数据,也可以看做一个业务场景就会有一组测试数据的应用,那么对于这种场景我们在应用HttpRunner 构建脚本的时候,要如何去设计数据格式以及引用呢?
接下来本篇内容主要介绍了如何使用关联参数以及引用过CSV文件进行参数化;
1. 源码解析
使用httprunner 改造过的pytest 参数化,通过parameters 这个字段去引用
import pytest
from httprunner import Parameters
在pytest 格式的脚本中ctrl+单击 Parameters 方法,如下图:
跳转到httprunner 的解析器文件parser.py :
2. 关联参数
2.1 单个参数场景的参数化驱动
请求API :http://www.woshipm.com/api2/user/followings/status
对于这个接口需要传入一个authorIds ,对应的值为单个作者ID ,那么我们如果向这个参数同时传入多组数据呢?而一组数据即可执行一个测试场景;
2.1.1 yaml格式用法
config:
name: testcase description
parameters:
author_id: ['801994', '1229873', '757351', '859990']
...
teststeps:
- name:
request:
...
method: GET
params:
authorIds: ${author_id}
...
...
由于我这里的请求方式为GET 所以使用params 作为关键字,如果是POST 的话,可以将params 修改为json ;
示例如下: .env 文件内容如下:
base_url=http://www.woshipm.com
完整代码:
config:
name: testcase description
parameters:
author_id: ['801994', '1229873', '757351', '859990']
variables: {}
verify: false
base_url: ${ENV(base_url)}
teststeps:
- name: /api2/user/followings/status
request:
cookies:
Hm_lpvt_b85cbcc76e92e3fd79be8f2fed0f504f: '1628342649'
Hm_lvt_b85cbcc76e92e3fd79be8f2fed0f504f: 1628163442,1628172667,1628334320
_DAU: done%21
article_detail_normal: article_user_profile@article_items
article_index: ''
article_user_profile: article_recom_users@author_items
dts_device_info: '%7B%22device_id%22%3A%22device_0ca45ac5-91b5-48f1-989f-09d72908c13f%22%2C%22device_brand%22%3A%22%22%2C%22device_model%22%3A%22%22%2C%22client_type%22%3A%22pc%22%2C%22os_type%22%3A%22Win32%22%2C%22os_version%22%3A%22%22%2C%22network_type%22%3A%22%22%2C%22browser_type%22%3A%22Chrome%22%2C%22browser_version%22%3A%2291.0.4472.124%22%7D'
firstVisitTime: '1628342605147'
isOverlayShowx: VVVV
new_device_id: device_0ca45ac5-91b5-48f1-989f-09d72908c13f
post_view_4751263: '2'
s: NjM4ODgxLCwxNjI4MzQyNjAzOTM1LCxodHRwczovL3N0YXRpYy5xaWRpYW5sYS5jb20vd29zaGlwbV9kZWZfaGVhZF8xLmpwZywseWMsLDRkNDI0MzM0Y2U2NDQ2NDI5MThlNjFiZjNlZmQ5NjgzLTAtMQ%3D%3D
t: MGJRTW5TU0xiU3M0TEY1QUg0N1NnTFhsWXVoYm5nOFlrbVM5MEpRbDEzaTI0TTk4NHFhTEZMSW1YZ0lnNEw0WU0wMXdhbVJFYTBmNnNrNDJpQUZRcG4xZXFwWHQwc3ZoL0Y2U0dhMHM0WTRrZ3RGU2dYMDM0WEU2OGU4b3FRTDA%3D
wordpress_logged_in_41071e66c7856d347ba575b5339c5a86: 18144854885%7C1629552204%7CcnJRMC1LLCPnvL3ZEGLxFpuh3LXe1JeyovQ8OlsPvm6%7C3b42d3281e8bef80c1f7ef7c44ff0b7430bed59c80ff13f7e97cb93c3805feee
headers:
Accept: application/json, text/plain, */*
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
COMMON_ACCESS_TOKEN: MGJRTW5TU0xiU3M0TEY1QUg0N1NnTFhsWXVoYm5nOFlrbVM5MEpRbDEzaTI0TTk4NHFhTEZMSW1YZ0lnNEw0WU0wMXdhbVJFYTBmNnNrNDJpQUZRcG4xZXFwWHQwc3ZoL0Y2U0dhMHM0WTRrZ3RGU2dYMDM0WEU2OGU4b3FRTDA=
COMMON_ACCESS_TOKEN_SECRET: NjM4ODgxLCwxNjI4MzQyNjAzOTM1LCxodHRwczovL3N0YXRpYy5xaWRpYW5sYS5jb20vd29zaGlwbV9kZWZfaGVhZF8xLmpwZywseWMsLDRkNDI0MzM0Y2U2NDQ2NDI5MThlNjFiZjNlZmQ5NjgzLTAtMQ==
Connection: keep-alive
Cookie: new_device_id=device_0ca45ac5-91b5-48f1-989f-09d72908c13f; isOverlayShowx=VVVV;
Hm_lvt_b85cbcc76e92e3fd79be8f2fed0f504f=1628163442,1628172667,1628334320;
dts_device_info=%7B%22device_id%22%3A%22device_0ca45ac5-91b5-48f1-989f-09d72908c13f%22%2C%22device_brand%22%3A%22%22%2C%22device_model%22%3A%22%22%2C%22client_type%22%3A%22pc%22%2C%22os_type%22%3A%22Win32%22%2C%22os_version%22%3A%22%22%2C%22network_type%22%3A%22%22%2C%22browser_type%22%3A%22Chrome%22%2C%22browser_version%22%3A%2291.0.4472.124%22%7D;
article_index=; article_user_profile=article_recom_users@author_items;
article_detail_normal=article_user_profile@article_items; _DAU=done%21;
wordpress_logged_in_41071e66c7856d347ba575b5339c5a86=18144854885%7C1629552204%7CcnJRMC1LLCPnvL3ZEGLxFpuh3LXe1JeyovQ8OlsPvm6%7C3b42d3281e8bef80c1f7ef7c44ff0b7430bed59c80ff13f7e97cb93c3805feee;
t=MGJRTW5TU0xiU3M0TEY1QUg0N1NnTFhsWXVoYm5nOFlrbVM5MEpRbDEzaTI0TTk4NHFhTEZMSW1YZ0lnNEw0WU0wMXdhbVJFYTBmNnNrNDJpQUZRcG4xZXFwWHQwc3ZoL0Y2U0dhMHM0WTRrZ3RGU2dYMDM0WEU2OGU4b3FRTDA%3D;
s=NjM4ODgxLCwxNjI4MzQyNjAzOTM1LCxodHRwczovL3N0YXRpYy5xaWRpYW5sYS5jb20vd29zaGlwbV9kZWZfaGVhZF8xLmpwZywseWMsLDRkNDI0MzM0Y2U2NDQ2NDI5MThlNjFiZjNlZmQ5NjgzLTAtMQ%3D%3D;
firstVisitTime=1628342605147; post_view_4751263=2; Hm_lpvt_b85cbcc76e92e3fd79be8f2fed0f504f=1628342649
Host: www.woshipm.com
Referer: http://www.woshipm.com/u/801994
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36
X-WP-Nonce: 452000896a
method: GET
params:
authorIds: ${author_id}
url: /api2/user/followings/status
extract:
- request_id: body.REQUEST_ID
validate:
- eq:
- status_code
- 200
- eq:
- headers.Content-Type
- application/json;charset=UTF-8
- eq:
- body.CODE
- 200
- eq:
- body.MESSAGE
- 请求成功
- eq:
- body.REQUEST_ID
- ${request_id}
- eq:
- body.HOST_ID
- localhost
2.1.2 pytest格式用法
在使用参数化之前,必须要导入pytest 库,和httprunner 库的Parameters 类;
使用httprunner 改造过的pytest 参数化,通过parameters 这个字段去引用
import pytest
from httprunner import Parameters
from httprunner import HttpRunner, Config, Step, RunRequest, RunTestCase
class TestCaseWoshipmGetAuthor(HttpRunner):
@pytest.mark.parametrize(
"param", Parameters({"author_id": ["801994", "1229873", "757351", "859990"]})
)
def test_start(self, param):
super().test_start(param)
config = Config("testcase description").base_url("${ENV(base_url)}").verify(False)
teststeps = [
Step(
RunRequest("/api2/user/followings/status")
.get("/api2/user/followings/status")
.with_params(**{"authorIds": "${author_id}"})
...
示例如下:
import pytest
from httprunner import Parameters
from httprunner import HttpRunner, Config, Step, RunRequest, RunTestCase
class TestCaseWoshipmGetAuthor(HttpRunner):
@pytest.mark.parametrize(
"param", Parameters({"author_id": ["801994", "1229873", "757351", "859990"]})
)
def test_start(self, param):
super().test_start(param)
config = Config("testcase description").base_url("${ENV(base_url)}").verify(False)
teststeps = [
Step(
RunRequest("/api2/user/followings/status")
.get("/api2/user/followings/status")
.with_params(**{"authorIds": "${author_id}"})
.with_headers(
**{
"Accept": "application/json, text/plain, */*",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "zh-CN,zh;q=0.9",
"COMMON_ACCESS_TOKEN": "MGJRTW5TU0xiU3M0TEY1QUg0N1NnTFhsWXVoYm5nOFlrbVM5MEpRbDEzaTI0TTk4NHFhTEZMSW1YZ0lnNEw0WU0wMXdhbVJFYTBmNnNrNDJpQUZRcG4xZXFwWHQwc3ZoL0Y2U0dhMHM0WTRrZ3RGU2dYMDM0WEU2OGU4b3FRTDA=",
"COMMON_ACCESS_TOKEN_SECRET": "NjM4ODgxLCwxNjI4MzQyNjAzOTM1LCxodHRwczovL3N0YXRpYy5xaWRpYW5sYS5jb20vd29zaGlwbV9kZWZfaGVhZF8xLmpwZywseWMsLDRkNDI0MzM0Y2U2NDQ2NDI5MThlNjFiZjNlZmQ5NjgzLTAtMQ==",
"Connection": "keep-alive",
"Cookie": "new_device_id=device_0ca45ac5-91b5-48f1-989f-09d72908c13f; isOverlayShowx=VVVV; Hm_lvt_b85cbcc76e92e3fd79be8f2fed0f504f=1628163442,1628172667,1628334320; dts_device_info=%7B%22device_id%22%3A%22device_0ca45ac5-91b5-48f1-989f-09d72908c13f%22%2C%22device_brand%22%3A%22%22%2C%22device_model%22%3A%22%22%2C%22client_type%22%3A%22pc%22%2C%22os_type%22%3A%22Win32%22%2C%22os_version%22%3A%22%22%2C%22network_type%22%3A%22%22%2C%22browser_type%22%3A%22Chrome%22%2C%22browser_version%22%3A%2291.0.4472.124%22%7D; article_index=; article_user_profile=article_recom_users@author_items; article_detail_normal=article_user_profile@article_items; _DAU=done%21; wordpress_logged_in_41071e66c7856d347ba575b5339c5a86=18144854885%7C1629552204%7CcnJRMC1LLCPnvL3ZEGLxFpuh3LXe1JeyovQ8OlsPvm6%7C3b42d3281e8bef80c1f7ef7c44ff0b7430bed59c80ff13f7e97cb93c3805feee; t=MGJRTW5TU0xiU3M0TEY1QUg0N1NnTFhsWXVoYm5nOFlrbVM5MEpRbDEzaTI0TTk4NHFhTEZMSW1YZ0lnNEw0WU0wMXdhbVJFYTBmNnNrNDJpQUZRcG4xZXFwWHQwc3ZoL0Y2U0dhMHM0WTRrZ3RGU2dYMDM0WEU2OGU4b3FRTDA%3D; s=NjM4ODgxLCwxNjI4MzQyNjAzOTM1LCxodHRwczovL3N0YXRpYy5xaWRpYW5sYS5jb20vd29zaGlwbV9kZWZfaGVhZF8xLmpwZywseWMsLDRkNDI0MzM0Y2U2NDQ2NDI5MThlNjFiZjNlZmQ5NjgzLTAtMQ%3D%3D; firstVisitTime=1628342605147; post_view_4751263=2; Hm_lpvt_b85cbcc76e92e3fd79be8f2fed0f504f=1628342649",
"Host": "www.woshipm.com",
"Referer": "http://www.woshipm.com/u/801994",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
"X-WP-Nonce": "452000896a",
}
)
.with_cookies(
**{
"Hm_lpvt_b85cbcc76e92e3fd79be8f2fed0f504f": "1628342649",
"Hm_lvt_b85cbcc76e92e3fd79be8f2fed0f504f": "1628163442,1628172667,1628334320",
"_DAU": "done%21",
"article_detail_normal": "article_user_profile@article_items",
"article_index": "",
"article_user_profile": "article_recom_users@author_items",
"dts_device_info": "%7B%22device_id%22%3A%22device_0ca45ac5-91b5-48f1-989f-09d72908c13f%22%2C%22device_brand%22%3A%22%22%2C%22device_model%22%3A%22%22%2C%22client_type%22%3A%22pc%22%2C%22os_type%22%3A%22Win32%22%2C%22os_version%22%3A%22%22%2C%22network_type%22%3A%22%22%2C%22browser_type%22%3A%22Chrome%22%2C%22browser_version%22%3A%2291.0.4472.124%22%7D",
"firstVisitTime": "1628342605147",
"isOverlayShowx": "VVVV",
"new_device_id": "device_0ca45ac5-91b5-48f1-989f-09d72908c13f",
"post_view_4751263": "2",
"s": "NjM4ODgxLCwxNjI4MzQyNjAzOTM1LCxodHRwczovL3N0YXRpYy5xaWRpYW5sYS5jb20vd29zaGlwbV9kZWZfaGVhZF8xLmpwZywseWMsLDRkNDI0MzM0Y2U2NDQ2NDI5MThlNjFiZjNlZmQ5NjgzLTAtMQ%3D%3D",
"t": "MGJRTW5TU0xiU3M0TEY1QUg0N1NnTFhsWXVoYm5nOFlrbVM5MEpRbDEzaTI0TTk4NHFhTEZMSW1YZ0lnNEw0WU0wMXdhbVJFYTBmNnNrNDJpQUZRcG4xZXFwWHQwc3ZoL0Y2U0dhMHM0WTRrZ3RGU2dYMDM0WEU2OGU4b3FRTDA%3D",
"wordpress_logged_in_41071e66c7856d347ba575b5339c5a86": "18144854885%7C1629552204%7CcnJRMC1LLCPnvL3ZEGLxFpuh3LXe1JeyovQ8OlsPvm6%7C3b42d3281e8bef80c1f7ef7c44ff0b7430bed59c80ff13f7e97cb93c3805feee",
}
)
.extract()
.with_jmespath("body.REQUEST_ID", "request_id")
.validate()
.assert_equal("status_code", 200)
.assert_equal('headers."Content-Type"', "application/json;charset=UTF-8")
.assert_equal("body.CODE", 200)
.assert_equal("body.MESSAGE", "请求成功")
.assert_equal("body.REQUEST_ID", "${request_id}")
.assert_equal("body.HOST_ID", "localhost")
),
]
if __name__ == "__main__":
TestCaseWoshipmGetAuthor().test_start()
2.2 多个参数场景的参数化
2.2.1 yaml格式用法
config:
name: testcase description
parameters:
base_url: ${ENV(base_url)}
user-password:
- ["user01", "pasw01"]
- ["user02", "pasw02"]
- ["user03", "pasw03"]
...
teststeps:
- name:
request:
...
method: POST
json:
username: ${user}
passworld: ${password}
...
...
2.2.2 pytest格式用法
import pytest
from httprunner import Parameters
from httprunner import HttpRunner, Config, Step, RunRequest, RunTestCase
class TestCaseLoginParams2(HttpRunner):
@pytest.mark.parametrize(
"param",
Parameters(
{
"user-password": [
["user01", "pasw01"],
["user02", "pasw02"],
["user03", "pasw03"],
]
}
),
)
def test_start(self, param):
super().test_start(param)
config = Config("login case").base_url("${ENV(base_url)}")
teststeps = [
Step(
RunRequest("step login")
.post("/api/v1/login")
.with_json({"username": "$user", "password": "$password"})
.validate()
.assert_equal("status_code", 200)
...
),
]
if __name__ == "__main__":
TestCaseLoginParams2().test_start()
2.2.3 笛卡尔积组合用法
如下示例笛卡尔积组合的话,就有4*4=16 中组合;
yaml格式:
config:
name: login case
base_url: ${ENV(base_url)}
parameters:
user: ["user01", "user02", "user03", "user04"]
password: ["123456", "123456", "123456", "123456"]
teststeps:
-
name: step login
variables:
password: 123456
request:
url: /api/v1/login
method: POST
json:
username: ${user}
password: ${password}
validate:
...
pytest格式:
import pytest
from httprunner import Parameters
from httprunner import HttpRunner, Config, Step, RunRequest, RunTestCase
class TestCaseLoginParams3(HttpRunner):
@pytest.mark.parametrize(
"param",
Parameters(
{
"user": ["user01", "user02", "user03", "user04"],
"password": ["123456", "123456", "123456", "123456"],
}
),
)
def test_start(self, param):
super().test_start(param)
config = Config("login case").base_url("${ENV(base_url)}")
teststeps = [
Step(
RunRequest("step login")
.with_variables(**{"password": 123456})
.post("/api/v1/login")
.with_json({"username": "${user}", "password": "${password}"})
.validate()
.assert_equal("status_code", 200)
...
),
]
if __name__ == "__main__":
TestCaseLoginParams3().test_start()
3. 引用CSV文件进行参数关联
为了要使用csv 文件进行参数化呢?
对于已有参数的列表,在我们实际业务当中,可能要使用数据量比较大的情况,在httprunner 框架比较适合的方式就是将参数列表值存储在csv 文件中;
而对于csv 数据文件,需要注意的几项:
csv 文件中的首行必须为参数名称,则从第二行开始为参数值,每个/组占一行;- 若同一个
csv 文件中存在多个参数,则参数名称和参数值使用英文逗号作为间隔符; - 在
yaml/json 文件引用csv 文件时,文件路径为基于项目根目录,即为debugtalk.py 文件所在同级路径的相对路径;
首先在项目har 目录同级新建一个目录data ,并新建user_password.csv 文件,内容如下:
user,password
user01,123456
user02,123456
user03,123456
user04,123456
3.1 yanl 格式用法
然后在YAML/JSON 测试用例文件中,就可以通过内置的 parameterize (可简写为 P)函数引用 CSV 文件;
即 P 函数的参数(CSV 文件路径)是相对于项目根目录的相对路径。 当然,这里也可以使用 CSV 文件在系统中的绝对路径,不过这样的话在项目路径变动时就会出现问题,因此推荐使用相对路径的形式;
然后使用相对路径引用data/user_password.csv :
config:
name: login case
base_url: ${ENV(base_url)}
parameters:
user-password: ${P(data/user_password.csv)}
teststeps:
-
name: step login
request:
url: /api/v1/login
method: POST
json:
username: ${user}
password: ${password}
validate:
- eq: [status_code, 200]
...
3.2 pytest 格式用法
注意要重写父类的方法test_start ,将的参数化变量传进去;
def test_start(self, param):
super().test_start(param)
import pytest
from httprunner import Parameters
from httprunner import HttpRunner, Config, Step, RunRequest, RunTestCase
class TestCaseParamsCsv2(HttpRunner):
@pytest.mark.parametrize(
"param", Parameters(
{
"user-password": "${P(data/user_password.csv)}"
}
)
)
def test_start(self, param):
super().test_start(param)
config = Config("login case").base_url("${ENV(base_url)}")
teststeps = [
Step(
RunRequest("step login")
.post("/api/v1/login")
.with_json({"username": "${user}", "password": "${password}"})
.validate()
.assert_equal("status_code", 200)
...
),
]
if __name__ == "__main__":
TestCaseParamsCsv2().test_start()
3.3 示例
csv 文件内容如下:
测试用例如下:
config:
name: testcase description
parameters:
author_id: ${P(data/author_id.csv)}
variables: {}
verify: false
base_url: ${ENV(base_url)}
teststeps:
- name: /api2/user/followings/status
request:
cookies:
Hm_lpvt_b85cbcc76e92e3fd79be8f2fed0f504f: '1628342649'
Hm_lvt_b85cbcc76e92e3fd79be8f2fed0f504f: 1628163442,1628172667,1628334320
_DAU: done%21
article_detail_normal: article_user_profile@article_items
article_index: ''
article_user_profile: article_recom_users@author_items
dts_device_info: '%7B%22device_id%22%3A%22device_0ca45ac5-91b5-48f1-989f-09d72908c13f%22%2C%22device_brand%22%3A%22%22%2C%22device_model%22%3A%22%22%2C%22client_type%22%3A%22pc%22%2C%22os_type%22%3A%22Win32%22%2C%22os_version%22%3A%22%22%2C%22network_type%22%3A%22%22%2C%22browser_type%22%3A%22Chrome%22%2C%22browser_version%22%3A%2291.0.4472.124%22%7D'
firstVisitTime: '1628342605147'
isOverlayShowx: VVVV
new_device_id: device_0ca45ac5-91b5-48f1-989f-09d72908c13f
post_view_4751263: '2'
s: NjM4ODgxLCwxNjI4MzQyNjAzOTM1LCxodHRwczovL3N0YXRpYy5xaWRpYW5sYS5jb20vd29zaGlwbV9kZWZfaGVhZF8xLmpwZywseWMsLDRkNDI0MzM0Y2U2NDQ2NDI5MThlNjFiZjNlZmQ5NjgzLTAtMQ%3D%3D
t: MGJRTW5TU0xiU3M0TEY1QUg0N1NnTFhsWXVoYm5nOFlrbVM5MEpRbDEzaTI0TTk4NHFhTEZMSW1YZ0lnNEw0WU0wMXdhbVJFYTBmNnNrNDJpQUZRcG4xZXFwWHQwc3ZoL0Y2U0dhMHM0WTRrZ3RGU2dYMDM0WEU2OGU4b3FRTDA%3D
wordpress_logged_in_41071e66c7856d347ba575b5339c5a86: 18144854885%7C1629552204%7CcnJRMC1LLCPnvL3ZEGLxFpuh3LXe1JeyovQ8OlsPvm6%7C3b42d3281e8bef80c1f7ef7c44ff0b7430bed59c80ff13f7e97cb93c3805feee
headers:
Accept: application/json, text/plain, */*
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
COMMON_ACCESS_TOKEN: MGJRTW5TU0xiU3M0TEY1QUg0N1NnTFhsWXVoYm5nOFlrbVM5MEpRbDEzaTI0TTk4NHFhTEZMSW1YZ0lnNEw0WU0wMXdhbVJFYTBmNnNrNDJpQUZRcG4xZXFwWHQwc3ZoL0Y2U0dhMHM0WTRrZ3RGU2dYMDM0WEU2OGU4b3FRTDA=
COMMON_ACCESS_TOKEN_SECRET: NjM4ODgxLCwxNjI4MzQyNjAzOTM1LCxodHRwczovL3N0YXRpYy5xaWRpYW5sYS5jb20vd29zaGlwbV9kZWZfaGVhZF8xLmpwZywseWMsLDRkNDI0MzM0Y2U2NDQ2NDI5MThlNjFiZjNlZmQ5NjgzLTAtMQ==
Connection: keep-alive
Cookie: new_device_id=device_0ca45ac5-91b5-48f1-989f-09d72908c13f; isOverlayShowx=VVVV;
Hm_lvt_b85cbcc76e92e3fd79be8f2fed0f504f=1628163442,1628172667,1628334320;
dts_device_info=%7B%22device_id%22%3A%22device_0ca45ac5-91b5-48f1-989f-09d72908c13f%22%2C%22device_brand%22%3A%22%22%2C%22device_model%22%3A%22%22%2C%22client_type%22%3A%22pc%22%2C%22os_type%22%3A%22Win32%22%2C%22os_version%22%3A%22%22%2C%22network_type%22%3A%22%22%2C%22browser_type%22%3A%22Chrome%22%2C%22browser_version%22%3A%2291.0.4472.124%22%7D;
article_index=; article_user_profile=article_recom_users@author_items;
article_detail_normal=article_user_profile@article_items; _DAU=done%21;
wordpress_logged_in_41071e66c7856d347ba575b5339c5a86=18144854885%7C1629552204%7CcnJRMC1LLCPnvL3ZEGLxFpuh3LXe1JeyovQ8OlsPvm6%7C3b42d3281e8bef80c1f7ef7c44ff0b7430bed59c80ff13f7e97cb93c3805feee;
t=MGJRTW5TU0xiU3M0TEY1QUg0N1NnTFhsWXVoYm5nOFlrbVM5MEpRbDEzaTI0TTk4NHFhTEZMSW1YZ0lnNEw0WU0wMXdhbVJFYTBmNnNrNDJpQUZRcG4xZXFwWHQwc3ZoL0Y2U0dhMHM0WTRrZ3RGU2dYMDM0WEU2OGU4b3FRTDA%3D;
s=NjM4ODgxLCwxNjI4MzQyNjAzOTM1LCxodHRwczovL3N0YXRpYy5xaWRpYW5sYS5jb20vd29zaGlwbV9kZWZfaGVhZF8xLmpwZywseWMsLDRkNDI0MzM0Y2U2NDQ2NDI5MThlNjFiZjNlZmQ5NjgzLTAtMQ%3D%3D;
firstVisitTime=1628342605147; post_view_4751263=2; Hm_lpvt_b85cbcc76e92e3fd79be8f2fed0f504f=1628342649
Host: www.woshipm.com
Referer: http://www.woshipm.com/u/801994
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36
X-WP-Nonce: 452000896a
method: GET
params:
authorIds: ${author_id}
url: /api2/user/followings/status
extract:
- request_id: body.REQUEST_ID
validate:
- eq:
- status_code
- 200
- eq:
- headers.Content-Type
- application/json;charset=UTF-8
- eq:
- body.CODE
- 200
- eq:
- body.MESSAGE
- 请求成功
- eq:
- body.REQUEST_ID
- ${request_id}
- eq:
- body.HOST_ID
- localhost
|