想不明白,请教大佬,第二条用例怎么取的值还是 test1
# NOTE: Generated By HttpRunner v3.1.6
# FROM: testsuites/admin/医生端管理/queryDoctorInfo_suites.yaml
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent.parent.parent.parent))
import pytest
from httprunner import Parameters
from httprunner import HttpRunner, Config, Step, RunRequest, RunTestCase
from testcases.admin.医生端管理.queryDoctorInfo_test import (
TestCaseQuerydoctorinfo as Querydoctorinfo,
)
class TestCaseQuerydoctorinfoSuites(HttpRunner):
@user1ize(
"param", Parameters({"user": ["test1", "test2", "test3", "test4"]})
)
def test_start(self, param):
super().test_start(param)
print(param)
config = Config("查询医生信息")
teststeps = [
Step(
RunTestCase("查询医生信息")
.with_variables(**{"user": "$user"})
.call(Querydoctorinfo)
),
]
if __name__ == "__main__":
TestCaseQuerydoctorinfoSuites().test_start()
```py
ASSED [ 50%]{'user': 'test2'}
2022-01-06 17:15:33.282 | INFO | httprunner.runner:test_start:451 - Start to run testcase: 查询医生信息, TestCase ID: ae983c31-8f6b-4c3f-96d5-fb09cf3dee41
2022-01-06 17:15:33.283 | INFO | httprunner.runner:run_step:292 - run step begin: 查询医生信息 >>>>>>
2022-01-06 17:15:33.284 | INFO | httprunner.runner:run_step:292 - run step begin: get_token >>>>>>
2022-01-06 17:15:33.284 | INFO | httprunner.runner:__run_step:292 - run step begin: login >>>>>>
2022-01-06 17:15:33.510 | DEBUG | httprunner.client:request:186 - client IP: 192.168.1.136, Port: 53858
2022-01-06 17:15:33.512 | DEBUG | httprunner.client:request:194 - server IP: 120.79.213.204, Port: 443
2022-01-06 17:15:33.513 | DEBUG | httprunner.client:log_print:40 -
2022-01-06 17:15:33.518 | INFO | httprunner.runner:__run_step:292 - run step begin: 查询医生信息 >>>>>>
2022-01-06 17:15:33.584 | DEBUG | httprunner.client:request:186 - client IP: 192.168.1.136, Port: 53858
2022-01-06 17:15:33.585 | DEBUG | httprunner.client:request:194 - server IP: 120.79.213.204, Port: 443
2022-01-06 17:15:33.585 | DEBUG | httprunner.client:log_print:40 -
================== request details ==================
method : POST
url : https://api.roujjk.com/jeecg/doctor/queryDoctorInfo
headers : {
"User-Agent": "python-requests/2.27.0",
"Accept-Encoding": "gzip, deflate",
"Accept": "/",
"Connection": "keep-alive",
"X-Access-Token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NDE0NjQxMzIsInVzZXJuYW1lIjoiQWRtaW5Bc3Npc3RhbnQifQ.JMDu-C1qGDbUVOagmK01LhKcH-xWpIpu-thR4rDxs-w",
"HRUN-Request-ID": "HRUN-ae983c31-8f6b-4c3f-96d5-fb09cf3dee41-533519",
"Cookie": "acw_tc=0bc676ac16414605333621916ec21ab34582f87b295bc52c6482d188755414",
"Content-Length": "24",
"Content-Type": "application/json"
}
cookies : {
"acw_tc": "0bc676ac16414605333621916ec21ab34582f87b295bc52c6482d188755414"
}
body : {
"searchValue": "test1"
}
2022-01-06 17:15:33.586 | DEBUG | httprunner.client:log_print:40 -
================== response details ==================
status_code : 200
headers : {
"Date": "Thu, 06 Jan 2022 09:15:33 GMT",
"Content-Type": "application/json;charset=UTF-8",
"Transfer-Encoding": "chunked",
"Connection": "keep-alive",
"Server": "openresty/1.19.3.1",
"Access-Control-Allow-Methods": "GET,POST,OPTIONS,PUT,DELETE"
}
cookies : {}
encoding : UTF-8
content_type : application/json;charset=UTF-8
body : {
"success": true,
"message": "操作成功!",
"code": 200,
"result": {
"count": 0,
"dataSet": []
},
"data": null,
"timestamp": 1641460533598
}
2022-01-06 17:15:33.586 | INFO | httprunner.client:request:218 - status_code: 200, response_time(ms): 65.09 ms, response_length: 0 bytes
2022-01-06 17:15:33.587 | INFO | httprunner.response:validate:249 - assert status_code equal 200(int) ==> pass
2022-01-06 17:15:33.587 | INFO | httprunner.response:validate:249 - assert body.code equal 200(int) ==> pass
2022-01-06 17:15:33.587 | INFO | httprunner.response:validate:249 - assert body.message equal 操作成功!(str) ==> pass
2022-01-06 17:15:33.588 | INFO | httprunner.runner:__run_step:304 - run step end: 查询医生信息 <<<<<<
2022-01-06 17:15:33.588 | INFO | httprunner.runner:__run_step:304 - run step end: 查询医生信息 <<<<<<
2022-01-06 17:15:33.588 | INFO | httprunner.runner:test_start:460 - generate testcase log: /Users/huangbinbin/Desktop/roujik-test/http-roujjk/logs/ae983c31-8f6b-4c3f-96d5-fb09cf3dee41.run.log