1上传新的接口测试方法 2.上传接口测试用例

This commit is contained in:
byb11
2021-04-28 18:13:54 +08:00
parent ff24ca2b53
commit 253793312b
4 changed files with 208 additions and 22 deletions

View File

@@ -22,23 +22,24 @@ def FieldValidation(responsedict, targetlist):
responsekeys = getKeys(response)
# 判断目的条件的Key在数据中是否存在
if target[0] in responsekeys:
#targetkey 判断的字段
targetkey = target[0]
# 判断条件
conditions = target[1]
# 返回数据中对应key的Value列表
responsevaluelist = getjsonvalue(response,target[0])
for responsevalue in responsevaluelist:
#判断value值是否为列表转化为字符串
if isinstance(responsevalue, list):
responsevalue=str(responsevalue)
if len(target) == 3:
targetvalue = target[2]
p = conditional(conditions, responsevalue, targetkey, sum, targetvalue)
strlist.append(p)
elif len(target) == 2:
p = conditional(conditions, responsevalue, targetkey, sum)
strlist.append(p)
if len(target) != 1:
#targetkey 判断的字段
targetkey = target[0]
# 判断条件
conditions = target[1]
# 返回数据中对应key的Value列表
responsevaluelist = getjsonvalue(response,target[0])
for responsevalue in responsevaluelist:
#判断value值是否为列表转化为字符串
if isinstance(responsevalue, list):
responsevalue=str(responsevalue)
if len(target) == 3:
targetvalue = target[2]
p = conditional(conditions, responsevalue, targetkey, sum, targetvalue)
strlist.append(p)
elif len(target) == 2:
p = conditional(conditions, responsevalue, targetkey, sum)
strlist.append(p)
else:
str2 = "返回数据第" + str(sum) + "组数据中不存在该字段:" + target[0]
print(str2)