#全部执行并生成html测试报告
import unittest
#导入模板
from Iweb.tools.HTMLTestReportCN_New import HTMLTestRunner
from time import sleep,strftime
#生成测试套件
suite=unittest.defaultTestLoader.discover("./","Iweb*.py")
#执行指定目录下的所有文件
#设置报告存放路径
path="../reports/"
#报告名字
name1=path+"Iwebshop测试报告"+strftime("%Y%m%d %H%M%S")+".html"
#执行测试报告,生成测试套件
with open(name1,"wb") as file:
#实例化文件模板
runner=HTMLTestRunner(stream=file,
title="Iwebshop自动化测试报告",
description="项目版本:1.0;"
"selenium:3.241.0:"
"操作系统:win7,64位"
"python:3.7.0"
"pycharm:社区版;"
"浏览器:chrome 92.0",
tester="刘明超"
)
runner.run(suite)
自动化测试——unittest生成HTML测试报告
最新推荐文章于 2024-04-22 21:15:28 发布