You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

run_http_html.py 1.6 KiB

2 years ago
1234567891011121314151617181920212223242526272829303132333435363738
  1. # -*- coding: utf-8 -*-
  2. # @Author : leizi
  3. import os, datetime, time
  4. from testCase.case import testinterface
  5. from public.py_Html import createHtml
  6. from public.get_excel import datacel
  7. from public.Dingtalk import send_ding
  8. '''执行测试的主要文件'''
  9. def start_interface_html_http():
  10. starttime = datetime.datetime.now()
  11. day = time.strftime("%Y%m%d%H%M", time.localtime(time.time()))
  12. basdir = os.path.abspath(os.path.dirname(__file__))
  13. path = os.path.join(os.path.join(os.getcwd(), 'test_case_data'), 'case.xlsx')
  14. listid, listkey, listconeent, listurl, listfangshi, listqiwang, listname = datacel(path)
  15. listrelust, list_fail, list_pass, list_json, list_exption, list_weizhi = testinterface()
  16. filepath = os.path.join(os.path.join(basdir, 'test_Report'), '%s-result.html' % day)
  17. if os.path.exists(filepath) is False:
  18. os.system(r'touch %s' % filepath)
  19. endtime = datetime.datetime.now()
  20. createHtml(titles=u'http接口自动化测试报告', filepath=filepath, starttime=starttime,
  21. endtime=endtime, passge=list_pass, fail=list_fail,
  22. id=listid, name=listname, key=listkey, coneent=listconeent, url=listurl, meth=listfangshi,
  23. yuqi=listqiwang, json=list_json, relusts=listrelust, weizhi=list_weizhi, exceptions=list_exption)
  24. # contec = u'http接口自动化测试完成,测试通过:%s,测试失败:%s,异常:%s,未知错误:%s,详情见:%s' % (
  25. # list_pass, list_fail, list_exption, list_weizhi, filepath)
  26. # send_ding(content=contec)
  27. if __name__ == '__main__':
  28. start_interface_html_http()

Introduction

生成接口测试报告

No topics