问题描述:
- allure 报告中不展示任何信息
- 日志中 allure-results does not exists
我的理解与尝试:
- allure生成results 再通过report展示。jenkins配置好后根据jenkins allure-report配置把运行结果存储在ResultsPath配置目录中。再通过ReportPath配置的目录启动allure服务读取results数据。
- 猜测问题应该是report未获取到results但是如何引用的???
本地执行:
pytest --alluredir path —> path目录可见results
allure serve path --> 启动report html页面回显数据正常
jenkins allure-report 配置
jenkins batch
日志信息
Started by user admin
Running as SYSTEM
Building in workspace C:\WINDOWS\system32\config\systemprofile\AppData\Local\Jenkins\.jenkins\workspace\api test
[api test] $ cmd /c call C:\WINDOWS\TEMP\jenkins4765796933946690126.bat
C:\WINDOWS\system32\config\systemprofile\AppData\Local\Jenkins\.jenkins\workspace\api test>pytest -v -s E:\GitHub\paasapitest\testcase\demo\test_demo.py --alluredir E:\GitHub\paasapitest\report\demo\allure-results
============================= test session starts =============================
platform win32 -- Python 3.6.5, pytest-5.4.2, py-1.8.1, pluggy-0.13.1 -- d:\python3.6\python.exe
cachedir: .pytest_cache
rootdir: C:\Windows\System32\config\systemprofile\AppData\Local\Jenkins\.jenkins\workspace\api test
plugins: allure-pytest-2.8.13, forked-1.3.0, repeat-0.8.0, xdist-1.34.0
collecting ... collected 1 item
::TestDemo::test_demo PASSED
============================== 1 passed in 0.06s ==============================
C:\WINDOWS\system32\config\systemprofile\AppData\Local\Jenkins\.jenkins\workspace\api test>exit 0
[api test] $ D:\allure-2.13.3\bin\allure.bat generate -c -o E:\GitHub\paasapitest\report\demo\allure-report
allure-results does not exists
Report successfully generated to E:\GitHub\paasapitest\report\demo\allure-report
Allure report was successfully generated.
Creating artifact for the build.
Artifact was added to the build.
Finished: SUCCESS
目录信息
E:\GitHub\paasapitest\report\demo\allure-report>dir
2020/12/09 11:12 <DIR> .
2020/12/09 11:12 <DIR> ..
2020/12/09 11:12 682,840 app.js
2020/12/09 11:12 <DIR> data
2020/12/09 11:12 <DIR> export
2020/12/09 11:12 57 favicon.ico
2020/12/09 11:12 <DIR> history
2020/12/09 11:12 657 index.html
2020/12/09 11:12 <DIR> plugins
2020/12/09 11:12 1,539,624 styles.css
2020/12/09 11:12 <DIR> widgets
4 个文件 2,223,178 字节
7 个目录 67,156,172,800 可用字节
E:\GitHub\paasapitest\report\demo\allure-results>dir
2020/12/09 11:12 556 a2ec701a-950a-4854-82db-75c657fb0985-result.json
2020/12/09 11:12 270 d73c6514-2142-4ec0-ab51-3c8f175adfb2-container.json
allure 报告展示
解决思路:
根据报错 allure-results does not exists 大方向是report找不到results。jenkins的allure插件report只会在当前wokrspace目录的子目录下找配置的reportResults;
解决方法:
- 修改job workspace目录
- pytest test_demo.py --alluredir %WORKSPACE%\results
- job allure配置results paht 为 results