1上传新的接口测试方法 2.上传接口测试用例
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user