Files
jiekou-python3/run_html.py

35 lines
1.3 KiB
Python
Raw Normal View History

2017-06-04 15:42:30 +08:00
# -*- coding: utf-8 -*-
# @Author : leizi
2017-06-18 13:52:56 +08:00
import unittest,os,datetime,time
2017-11-01 10:28:31 +08:00
from testCase.case import testinterface
from Public.py_Html import createHtml
2017-08-01 21:39:11 +08:00
from Public.get_excel import datacel
from Public.emmail import sendemali
2017-08-03 13:03:33 +08:00
from Public.create_report import save_result
2017-06-18 13:52:56 +08:00
import threading
def stast():
starttime=datetime.datetime.now()
2017-08-03 13:03:33 +08:00
day= time.strftime("%Y%m%d%H%M", time.localtime(time.time()))
2017-08-02 14:13:23 +08:00
basdir=os.path.abspath(os.path.dirname(__file__))
2017-08-01 21:39:11 +08:00
listid, listkey, listconeent, listurl, listfangshi, listqiwang, listname = datacel()
listrelust, list_fail, list_pass, list_json = testinterface()
2017-08-03 13:03:33 +08:00
filepath =os.path.join(basdir+'\\test_Report\\%s-result.html'%day)
if os.path.exists(filepath) is False:
os.system(r'touch %s' % filepath)
2017-08-03 13:03:33 +08:00
save_result(starttime,len(listrelust),((list_pass)),list_fail)
endtime=datetime.datetime.now()
2017-08-01 21:39:11 +08:00
createHtml(titles='接口测试报告',filepath=filepath,starttime=starttime,
endtime=endtime,passge=list_pass,fail=list_fail,
id=listid,name=listname,key=listkey,coneent=listconeent,url=listurl,meth=listfangshi,
yuqi=listqiwang,json=list_json,relusts=listrelust)
2017-06-18 13:52:56 +08:00
# sendemali(filepath)
2017-08-01 21:39:11 +08:00
def tThread():
2017-06-18 13:52:56 +08:00
m=threading.Thread(target=stast,args=())
m.run()
if __name__ == '__main__':
2017-08-03 13:03:33 +08:00
tThread()
2017-06-18 13:52:56 +08:00