4 Star 0 Fork 1

yuan/EcShop

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
ran_ecshop_case.py 1.00 KB
一键复制 编辑 原始数据 按行查看 历史
祝雪莉85 提交于 2021-07-23 09:32 +08:00 . run
#1.导入unittest和HTMLTestRunnerPlugins的包
import unittest
import HTMLTestRunnerPlugins
import os
import time
base_path=os.path.dirname(__file__) #项目路径
#print(base_path)
case_path=os.path.join(base_path,'Case') #用例路径
# print(case_path)
report_path=os.path.join(base_path,'Report') # 报告路径
# print(report_path)
#添加测试套件
test_suit=unittest.defaultTestLoader.discover(case_path)
#4.命名测试报告名称-->html文件
#获取时间
now=time.strftime('%Y-%m-%d %H_%M_%S')
#命令报告名称
report_name=now+'HTMLReport.html'
#5.执行用例并生成报告
with open(report_path+'\\'+report_name,'wb') as fp:
runner=HTMLTestRunnerPlugins.HTMLTestRunner(title="ecshop项目自动化测试报告",
description="web自动化测试",
tester="第七组",
stream=fp
)
runner.run(test_suit) #执行并生成
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/yuan-menghao/ec-shop.git
git@gitee.com:yuan-menghao/ec-shop.git
yuan-menghao
ec-shop
EcShop
master

搜索帮助