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_html.py 1.5 KiB

2 years ago
123456789101112131415161718192021222324252627282930313233343536
  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.create_report import save_result
  8. import threading
  9. def stast():
  10. starttime = datetime.datetime.now()
  11. day = time.strftime("%Y%m%d%H%M", time.localtime(time.time()))
  12. path = os.path.join(os.path.join(os.getcwd(), 'test_case_data'), 'case.xlsx')
  13. basdir = os.path.abspath(os.path.dirname(__file__))
  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. save_result(starttime, len(listrelust), ((list_pass)), list_fail)
  20. endtime = datetime.datetime.now()
  21. createHtml(titles='接口测试报告', filepath=filepath, starttime=starttime,
  22. endtime=endtime, passge=list_pass, fail=list_fail,
  23. id=listid, name=listname, key=listkey, coneent=listconeent, url=listurl, meth=listfangshi,
  24. yuqi=listqiwang, json=list_json, relusts=listrelust, exceptions=list_exption, weizhi=list_weizhi)
  25. # sendemali(filepath)
  26. def tThread():
  27. m = threading.Thread(target=stast, args=())
  28. m.run()
  29. if __name__ == '__main__':
  30. tThread()

Introduction

生成接口测试报告

No topics

Contributors (2)