修改问题 脱离python环境运行,查看allure测试报告

This commit is contained in:
HP_mojin 2023-12-21 11:33:53 +08:00
parent 0271e97082
commit d4038f38d9
4 changed files with 7 additions and 8 deletions

View File

@ -13,13 +13,12 @@ dataPath = os.path.join(base_path, 'data')
configPath = os.path.join(base_path, 'config')
logPath = os.path.join(base_path, 'logs')
picturePath = os.path.join(base_path, 'png')
reportsPath = os.path.join(base_path, 'target','static', 'allure-report')
reportsPath = os.path.join(base_path, 'target', 'allure-report')
screenPath = os.path.join(base_path, 'screencap')
targetPath=os.path.join(base_path, 'target', )
targetPath_static=os.path.join(base_path, 'target','static', )
targetPath=os.path.join(base_path, 'target')
#Start_server_bat=os.path.join(base_path, 'config',"Start_server.bat")
Start_server_bat=os.path.join(base_path, 'config',"fileServices.exe")
images_Path=os.path.join(base_path, 'config',"png") #./config/png
environmentPath=os.path.join(base_path, 'config',"environment.properties")
allure_results = os.path.join(targetPath_static, 'allure-results','environment.properties')
allure_results = os.path.join(targetPath, 'allure-results','environment.properties')

Binary file not shown.

View File

@ -19,6 +19,6 @@
<b><font color="#0B610B">查看附件报告方法:</font></b>
<hr size="2" width="100%" align="center"/>
1.解压allure-report.zip(接口测试报告)后,进入解压目录,运行 fileServices.exe <br/>
2.出现“Serving HTTP on :: port 5188 (http://[::]:5188/) ...”表示服务启动完成<br/>
2.出现 “Access address: http://localhost:5188“ 表示服务启动完成<br/>
<b>完成以上2步查看报告详情:</b> <a href="http://127.0.0.1:5188/allure-report">http://127.0.0.1:5188/allure-report</a><br/>

6
run.py
View File

@ -24,18 +24,18 @@ def run():
except:
pass
# --reruns = 3 失败重试
pytest.main(['./test_caes', '-vs', "--env=dev","--reruns=3", "--alluredir", "target/static/allure-results"]) # pytest测试框架主程序运行
pytest.main(['./test_caes', '-vs', "--env=prod","--reruns=3", "--alluredir", "target/allure-results"]) # pytest测试框架主程序运行
copy(all_path.Start_server_bat, all_path.targetPath) #拷贝 启动服务器脚本(config/Start_server.bat)由config目录拷贝到target目录下进行压缩打包发送邮件
copy(all_path.environmentPath, all_path.allure_results) # 拷贝 环境配置文件
allure_html = 'allure generate ./target/static/allure-results -o ./target/static/allure-report --clean' # 生成allure的html报告
allure_html = 'allure generate ./target/allure-results -o ./target/allure-report --clean' # 生成allure的html报告
subprocess.call(allure_html, shell=True) # 生成allure的html报告
# EmailServe.send_email(setting,all_path.targetPath,ExchangeData.get_pytest_summary()) #发送邮件
EmailServe.send_email(setting,all_path.targetPath,ExchangeData.get_pytest_summary()) #发送邮件