用例ID |
用例名字 |
key |
请求内容 |
url |
请求方式 |
预期 |
实际返回 |
结果 |
'''
def passfail(tend):
if tend == 'pass':
htl = '''pass | '''
elif tend == 'fail':
htl = '''fail | '''
elif tend == 'weizhi':
htl = '''error | '''
else:
htl = 'exect | '
return htl
def ceshixiangqing(reslt, id, name, key, coneent, url, meth, yuqi, json, relust):
xiangqing = '''
%s |
%s |
%s |
%s |
%s |
%s |
%s |
%s |
%s
''' % (reslt, id, name, key, coneent, url, meth, yuqi, json, passfail(relust))
return xiangqing
weibu = '''
'''
def relust(titles, starttime, endtime, passge, fail, id, name, key, coneent, url, meth, yuqi, json, relust, exceptions,
weizhi):
if type(name) == list:
relus = ' '
for i in range(len(name)):
if relust[i] == "pass":
clazz = "success"
elif relust[i] == "fail":
clazz = "warning"
elif relust[i] == "weizhi":
clazz = "danger"
else:
clazz = 'error'
relus += (
ceshixiangqing(clazz, id[i], name[i], key[i], coneent[i], url[i], meth[i], yuqi[i], json[i], relust[i]))
text = title(titles) + connent + shouye(starttime, endtime, passge, fail, exceptions,
weizhi) + shanghai + relus + weibu
else:
text = title(titles) + connent + shouye(starttime, endtime, passge, fail, exceptions,
weizhi) + shanghai + ceshixiangqing(id, name, key, coneent, url, meth,
yuqi, json, relust) + weibu
return text
def createHtml(filepath, titles, starttime, endtime, passge, fail, id, name, key, coneent, url, meth, yuqi, json,
relusts, exceptions, weizhi):
texts = relust(titles, starttime, endtime, passge, fail, id, name, key, coneent, url, meth, yuqi, json, relusts,
exceptions, weizhi)
with open(filepath, 'wb') as f:
f.write(texts.encode('utf-8'))