执行脚本:
运行测试并生成 Allure 结果数据
cd /var/jenkins_home/workspace/auto_test_invoice/automation_test/invoice_auto_test/test_cases
pytest --alluredir=allure-results
echo "Current directory: $(pwd)"
echo "Contents of current directory:"
ls -l
构建后操作:


构建过程中输出显示找不到 allure_results
++ pwd
- echo 'Current directory: /var/jenkins_home/workspace/auto_test_invoice/automation_test/invoice_auto_test/test_cases'
Current directory: /var/jenkins_home/workspace/auto_test_invoice/automation_test/invoice_auto_test/test_cases
- echo 'Contents of current directory:'
Contents of current directory:
- ls -l
total 2380
-rw-r--r-- 1 root root 0 Feb 13 09:07 init.py
drwxr-xr-x 1 root root 4096 Feb 13 09:08 pycache
drwxr-xr-x 1 root root 4096 Feb 13 09:07 allure-report
drwxr-xr-x 1 root root 4096 Feb 13 09:08 allure-results
-rw-r--r-- 1 root root 776554 Feb 13 09:00 app.js
drwxr-xr-x 1 root root 4096 Feb 13 09:00 data
drwxr-xr-x 1 root root 4096 Feb 13 09:00 export
-rw-r--r-- 1 root root 15086 Feb 13 09:00 favicon.ico
drwxr-xr-x 1 root root 4096 Feb 13 09:00 history
drwxr-xr-x 1 root root 4096 Feb 13 09:07 html
-rw-r--r-- 1 root root 665 Feb 13 09:00 index.html
drwxr-xr-x 1 root root 4096 Feb 13 09:00 plugins
-rw-r--r-- 1 root root 85783 Feb 13 09:08 report.html
-rw-r--r-- 1 root root 1542785 Feb 13 09:00 styles.css
-rw-r--r-- 1 root root 4789 Feb 13 09:07 test_group_kaipiao.py
drwxr-xr-x 1 root root 4096 Feb 13 09:00 widgets
Script returned:
[auto_test_invoice] $ /opt/allure/bin/allure generate -c -o /var/jenkins_home/workspace/auto_test_invoice/automation_test/invoice_auto_test/test_cases/allure-report
allure-results does not exist
↙↙↙阅读原文可查看相关链接,并与作者交流