和老师的结果不一样,报allure-results does not exist

来源:13-5 实战交易系统:Jenkins构建自动化测试

慕村1342571

2022-08-26

图片描述

E:\Virtual Machines\JenKins\.jenkins\workspace\trading_system_autotest>D:\IDE\Python\envs\spa\Scripts\python -m pytest ./fsauto/selenium/testcases/trade/test_jenkins.py -n auto --alluredir=E:\Virtual Machines\JenKins\.jenkins\workspace\trading_system_autotest\allure-results 
============================= test session starts =============================
platform win32 -- Python 3.7.6, pytest-7.1.2, pluggy-1.0.0
rootdir: E:\Virtual Machines\JenKins\.jenkins\workspace\trading_system_autotest, configfile: pytest.ini
plugins: allure-pytest-2.10.0, assume-2.4.3, forked-1.4.0, html-3.1.1, metadata-2.0.2, rerunfailures-10.2, xdist-2.5.0
gw0 I / gw1 I / gw2 I / gw3 I

[gw0] Python 3.7.6 (tags/v3.7.6:43364a7ae0, Dec 19 2019, 00:42:30) [MSC v.1916 64 bit (AMD64)]

[gw1] Python 3.7.6 (tags/v3.7.6:43364a7ae0, Dec 19 2019, 00:42:30) [MSC v.1916 64 bit (AMD64)]

[gw2] Python 3.7.6 (tags/v3.7.6:43364a7ae0, Dec 19 2019, 00:42:30) [MSC v.1916 64 bit (AMD64)]

[gw3] Python 3.7.6 (tags/v3.7.6:43364a7ae0, Dec 19 2019, 00:42:30) [MSC v.1916 64 bit (AMD64)]
gw0 [0] / gw1 [0] / gw2 [0] / gw3 [0]

scheduling tests via LoadScheduling

============================ no tests ran in 3.27s ============================

E:\Virtual Machines\JenKins\.jenkins\workspace\trading_system_autotest>exit 5 
Build step 'Execute Windows batch command' marked build as failure
[trading_system_autotest] $ "E:\Virtual Machines\JenKins\.jenkins\tools\ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation\Allure\bin\allure.bat" generate -c -o "E:\Virtual Machines\JenKins\.jenkins\workspace\trading_system_autotest\allure-report"
allure-results does not exist
Report successfully generated to E:\Virtual Machines\JenKins\.jenkins\workspace\trading_system_autotest\allure-report
Allure report was successfully generated.
Creating artifact for the build.
Artifact was added to the build.
Finished: FAILURE
写回答

1回答

william

2022-08-26

是不是pytest.ini里设置了allure报告的路径了?我看你给的日志里,报告是生成在

E:\Virtual Machines\JenKins\.jenkins\workspace\trading_system_autotest\allure-report

0
1
慕村1342571
确实是文件的路径设置问题,测试一下,总结以下几点: 1、.ini中的addopts、python_files、python_classes、python_functions可以用,但是testpaths最好不用; 2、--alluredir后面跟的路径里不要加空格,容易出问题; 3、如果使用不一样的项目名称或者路径,要确认common.tools中的get_project_path返回的目录和jenkins设置的任务名、--alluredir后面跟的路径中下载到workspace中的项目名是一致的 4、在构建的命令中,如果使用了虚拟环境可指定pytest.exe的全路径名后面跟alluredir参数,如 D:\IDE\Python\envs\fsauto\Scripts\pytest.exe --alluredir=E:\JenKins\.jenkins\workspace\fsauto\allure-results
2022-08-27
共1条回复

Selenium3+Pytest+Allure 全流程实战自动化测试

应用主流测试工具,从功能测试转型自动化测试

636 学习 · 227 问题

查看课程