调整UI自动化代码
This commit is contained in:
@@ -1,3 +1,46 @@
|
||||
|
||||
|
||||
|
||||
def FieldValidation(responsedict, targetlist):
|
||||
responselist = responsedict["data"]["list"]
|
||||
strlist = []
|
||||
if responselist:
|
||||
#循环返回数据列表
|
||||
sum = 1
|
||||
for response in responselist:
|
||||
# 循环目地列表
|
||||
for t in targetlist:
|
||||
#将目的根据空格分割成列表 (“key值”,“判断条件”,“value值”)
|
||||
target=t.split(" ")
|
||||
print("target",target)
|
||||
#判断目的条件的Key在数据中是否存在
|
||||
if target[0] in response:
|
||||
targetkey = target[0]
|
||||
#判断条件
|
||||
conditions=target[1]
|
||||
#目的Value
|
||||
# 对应Key返回数据的Value
|
||||
responsevalue = response[target[0]]
|
||||
print(targetkey,conditions,responsevalue)
|
||||
print(len(target))
|
||||
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)
|
||||
strlist.append(str2)
|
||||
sum+=1
|
||||
else:
|
||||
str3 = "返回数据中无数据"
|
||||
strlist.append(str3)
|
||||
|
||||
return strlist
|
||||
|
||||
def conditional(conditions,value2,targetkey,sum,value=None):
|
||||
str1=""
|
||||
if conditions == "=":
|
||||
@@ -90,49 +133,6 @@ def conditional(conditions,value2,targetkey,sum,value=None):
|
||||
|
||||
return str1
|
||||
|
||||
|
||||
def FieldValidation(responsedict, targetlist):
|
||||
responselist = responsedict["data"]["list"]
|
||||
strlist = []
|
||||
if responselist:
|
||||
#循环返回数据列表
|
||||
sum = 1
|
||||
for response in responselist:
|
||||
# 循环目地列表
|
||||
for t in targetlist:
|
||||
#将目的根据空格分割成列表 (“key值”,“判断条件”,“value值”)
|
||||
target=t.split(" ")
|
||||
print("target",target)
|
||||
#判断目的条件的Key在数据中是否存在
|
||||
if target[0] in response:
|
||||
targetkey = target[0]
|
||||
#判断条件
|
||||
conditions=target[1]
|
||||
#目的Value
|
||||
# 对应Key返回数据的Value
|
||||
responsevalue = response[target[0]]
|
||||
print(targetkey,conditions,responsevalue)
|
||||
print(len(target))
|
||||
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)
|
||||
strlist.append(str2)
|
||||
sum+=1
|
||||
else:
|
||||
str3 = "返回数据中无数据"
|
||||
strlist.append(str3)
|
||||
|
||||
return strlist
|
||||
|
||||
|
||||
|
||||
def Assertresults(resultslist):
|
||||
print(resultslist)
|
||||
for i in resultslist:
|
||||
|
||||
Reference in New Issue
Block a user