代码拉取完成,页面将自动刷新
# -*- coding: utf-8 -*-
# @Time : 2021/12/22 14:13
# @Author : Limusen
# @File : main
"""
测试用例的运行入口
"""
import os
import unittest
from common.config_utils import local_config
from common import HTMLTestReportCN
current = os.path.dirname(os.path.abspath(__file__))
case_path = os.path.join(current, local_config.case_path) # 在ini文件写入测试用例地址
report_path = os.path.join(current, local_config.report_path) # 在ini文件写入测试报告地址
def load_api_case():
discover_obj = unittest.defaultTestLoader.discover(start_dir=case_path,
pattern='test_login.py')
all_case_suite = unittest.TestSuite()
all_case_suite.addTest(discover_obj)
return discover_obj
if __name__ == '__main__':
# 创建网页版报告路径的对象
report_path_obj = HTMLTestReportCN.ReportDirectory(report_path)
# 创建报告
report_path_obj.create_dir("UI测试报告")
# 获取网页版报告的路径
html_report_obj = HTMLTestReportCN.GlobalMsg.get_value("report_path")
# print(html_report_obj)
html_report_file_obj = open(html_report_obj, 'wb')
runner = HTMLTestReportCN.HTMLTestRunner(stream=html_report_file_obj,
tester="limusen",
description="ui测试框架报告")
runner.run(load_api_case())
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。