mirror of https://gitee.com/a529548204/apitest.git
完善缓存功能 读取缓存 采用正则匹配 详情randomData.py中查看
This commit is contained in:
parent
859dfaa4ef
commit
1dfd4ba9df
|
@ -8,8 +8,8 @@
|
||||||
├─testsuite
|
├─testsuite
|
||||||
├─datas
|
├─datas
|
||||||
└─ 项目文件夹 名称同config中 testname一致
|
└─ 项目文件夹 名称同config中 testname一致
|
||||||
├─ urlData.yml
|
├─ urlData.yml # 所有 url 具体格式参考下面YAML URL格式说明
|
||||||
└─ login.yml
|
└─ login.yml # 用例数据 格式参考下面YAML PARAM格式说明
|
||||||
├─page # 所有请求封装 通过writePage.py根据url的yaml文件生成
|
├─page # 所有请求封装 通过writePage.py根据url的yaml文件生成
|
||||||
├─testcase
|
├─testcase
|
||||||
└─ 项目文件夹 名称同config中 testname一致 # 测试用例
|
└─ 项目文件夹 名称同config中 testname一致 # 测试用例
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
}
|
}
|
||||||
data:
|
data:
|
||||||
param: {
|
param: {
|
||||||
"username": "finsiot","password": $caches(pwd)$ # 读取缓存值
|
"username": "finsiot","password": _$caches(pwd)$ # 读取缓存值_
|
||||||
}
|
}
|
||||||
urlparam: {
|
urlparam: {
|
||||||
id: 123
|
id: 123
|
||||||
|
@ -79,7 +79,7 @@
|
||||||
regionList:
|
regionList:
|
||||||
name: '区域列表'
|
name: '区域列表'
|
||||||
host: 'host'
|
host: 'host'
|
||||||
address: '/v1/apps/region/'
|
address: '/v1/apps/$url(region_id)$/' # $url(region_id)$ 正则匹配参数中的路径参数
|
||||||
method: 'get'
|
method: 'get'
|
||||||
relevance:
|
relevance:
|
||||||
- cachefrom: 'body' # response : 从结果中获取 body : 从参数中获取
|
- cachefrom: 'body' # response : 从结果中获取 body : 从参数中获取
|
||||||
|
|
|
@ -243,3 +243,4 @@ if __name__ == '__main__':
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
}, host="host")
|
}, host="host")
|
||||||
print(ress)
|
print(ress)
|
||||||
|
que
|
|
@ -17,7 +17,7 @@ def ini_yaml(filename, path=datapath):
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# get_yaml_data(r"F:\api2.0\config\runConfig.yml")
|
# get_yaml_data(r"F:\api2.0\config\runConfig.yml")
|
||||||
runConfig_dict = ini_yaml("loginData.yml")
|
runConfig_dict = ini_yaml("loginData.yaml",path=r"D:\apitest\test_suite")
|
||||||
# case_level = runConfig_dict[0]["address"].format(**{"home_id": "123"})
|
# case_level = runConfig_dict[0]["address"].format(**{"home_id": "123"})
|
||||||
print(runConfig_dict)
|
print(runConfig_dict)
|
||||||
# print(case_level)
|
# print(case_level)
|
||||||
|
|
|
@ -29,9 +29,3 @@ def third_login():
|
||||||
res, restime = apisend(address=data["address"], method=data["method"], headers=paramData["headers"],
|
res, restime = apisend(address=data["address"], method=data["method"], headers=paramData["headers"],
|
||||||
data=paramData["data"])
|
data=paramData["data"])
|
||||||
return res
|
return res
|
||||||
@pytest.fixture(scope="module")
|
|
||||||
def relv():
|
|
||||||
global haha
|
|
||||||
haha=1
|
|
||||||
ca = Relevance()
|
|
||||||
return haha
|
|
Loading…
Reference in New Issue