Files
jiekou-python3/run_http_html.py

39 lines
1.6 KiB
Python
Raw Normal View History

2017-06-04 15:42:30 +08:00
# -*- coding: utf-8 -*-
# @Author : leizi
2020-05-09 21:24:18 +08:00
import os, datetime, time
2017-11-01 10:28:31 +08:00
from testCase.case import testinterface
2023-02-19 18:16:03 +08:00
from public.py_Html import createHtml
from public.get_excel import datacel
2023-02-19 18:16:03 +08:00
from public.Dingtalk import send_ding
2020-05-09 21:24:18 +08:00
2018-09-04 12:59:11 +08:00
'''执行测试的主要文件'''
2020-05-09 21:24:18 +08:00
2018-04-12 13:57:03 +08:00
def start_interface_html_http():
2020-05-09 21:24:18 +08:00
starttime = datetime.datetime.now()
day = time.strftime("%Y%m%d%H%M", time.localtime(time.time()))
basdir = os.path.abspath(os.path.dirname(__file__))
path = os.path.join(os.path.join(os.getcwd(), 'test_case_data'), 'case.xlsx')
2018-03-29 13:09:26 +08:00
listid, listkey, listconeent, listurl, listfangshi, listqiwang, listname = datacel(path)
2020-05-09 21:24:18 +08:00
listrelust, list_fail, list_pass, list_json, list_exption, list_weizhi = testinterface()
filepath = os.path.join(os.path.join(basdir, 'test_Report'), '%s-result.html' % day)
if os.path.exists(filepath) is False:
os.system(r'touch %s' % filepath)
2020-05-09 21:24:18 +08:00
endtime = datetime.datetime.now()
createHtml(titles=u'http接口自动化测试报告', 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, weizhi=list_weizhi, exceptions=list_exption)
2022-01-15 13:44:42 +08:00
# contec = u'http接口自动化测试完成测试通过:%s,测试失败:%s异常:%s,未知错误:%s,详情见:%s' % (
# list_pass, list_fail, list_exption, list_weizhi, filepath)
# send_ding(content=contec)
2020-05-09 21:24:18 +08:00
2017-06-18 13:52:56 +08:00
if __name__ == '__main__':
2020-05-09 21:24:18 +08:00
start_interface_html_http()