1. 程式人生 > 其它 >專案代號(名稱)

專案代號(名稱)

  • data --管理測試資料的資料夾
  • report --管理測試結果報告的資料夾
  • api --封裝被測試系統的介面
  • scripts --測試用例指令碼
  • tools --第三方工具包管理
  • app.py --配置資訊檔案
  • run_suite.py 測試用例執行入口
  • utils.py --自定義工具類

給生成報告新增時間:

import unittest
from script.yun_test_login import Yun_test2
from tools.HTMLTestRunner import HTMLTestRunner
from app import BASE_DIR
from script.test_ihrm_user import IhrmUserAll

# 載入到case套件裡
suite = unittest.TestSuite()
# suite.addTest(unittest.makeSuite(Yun_test2))
suite.addTest(unittest.makeSuite(IhrmUserAll))


import datetime
data_time = datetime.datetime.now()
str_datatime = datetime.datetime.strftime(data_time,'%Y-%m-%d %H%M%S')
print(str_datatime)
re_path="./report/yun_login_test--%s.html" % str_datatime


# 執行套件,生成測試報告
f = open(re_path, 'wb')
# f = open("./report/yun_login_test.html", 'wb')
runner = HTMLTestRunner(stream=f, title='雲系統登入測試報告', description='Chrome 瀏覽器') runner.run(suite) f.close()