2017-06-04 15:42:30 +08:00
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
# @Author : leizi
|
2018-03-12 21:00:36 +08:00
|
|
|
|
import os,datetime,time
|
2017-11-01 10:28:31 +08:00
|
|
|
|
from testCase.case import testinterface
|
2017-06-06 11:05:50 +08:00
|
|
|
|
from Public.py_Html import createHtml
|
2017-08-01 21:39:11 +08:00
|
|
|
|
from Public.get_excel import datacel
|
2018-04-12 13:57:03 +08:00
|
|
|
|
from Public.Dingtalk import send_ding
|
|
|
|
|
|
def start_interface_html_http():
|
2017-06-05 21:50:25 +08:00
|
|
|
|
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__))
|
2018-04-12 13:57:03 +08:00
|
|
|
|
path = os.getcwd() + '\\test_case_data\\case.xlsx'
|
2018-03-29 13:09:26 +08:00
|
|
|
|
listid, listkey, listconeent, listurl, listfangshi, listqiwang, listname = datacel(path)
|
2018-03-13 13:17:23 +08:00
|
|
|
|
listrelust, list_fail, list_pass, list_json,list_exption,list_weizhi = testinterface()
|
2017-08-03 13:03:33 +08:00
|
|
|
|
filepath =os.path.join(basdir+'\\test_Report\\%s-result.html'%day)
|
2017-06-05 21:50:25 +08:00
|
|
|
|
if os.path.exists(filepath) is False:
|
2017-06-06 11:05:50 +08:00
|
|
|
|
os.system(r'touch %s' % filepath)
|
2017-06-05 21:50:25 +08:00
|
|
|
|
endtime=datetime.datetime.now()
|
2018-04-30 14:04:31 +08:00
|
|
|
|
createHtml(titles=u'http接口自动化测试报告',filepath=filepath,starttime=starttime,
|
2017-08-01 21:39:11 +08:00
|
|
|
|
endtime=endtime,passge=list_pass,fail=list_fail,
|
|
|
|
|
|
id=listid,name=listname,key=listkey,coneent=listconeent,url=listurl,meth=listfangshi,
|
2018-03-13 13:17:23 +08:00
|
|
|
|
yuqi=listqiwang,json=list_json,relusts=listrelust,weizhi=list_weizhi,exceptions=list_exption)
|
2018-04-30 14:04:31 +08:00
|
|
|
|
contec = u'http接口自动化测试完成,测试通过:%s,测试失败:%s,异常:%s,未知错误:%s,详情见:%s' % (
|
2018-04-12 13:57:03 +08:00
|
|
|
|
list_pass, list_fail, list_exption, list_weizhi, filepath)
|
2018-04-30 14:04:31 +08:00
|
|
|
|
# send_ding(content=contec)
|
2017-06-18 13:52:56 +08:00
|
|
|
|
if __name__ == '__main__':
|
2018-04-12 13:57:03 +08:00
|
|
|
|
start_interface_html_http()
|