You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用upload-artifact上传自动化测试报告失败问题求助

问题分析与解决方案

核心问题

你遇到的"no files found under provided path"错误,主要来自两个问题:

  1. 多余的手动创建report文件夹步骤,干扰了实际测试报告的路径识别
  2. upload-artifact使用了不稳定的master分支版本,且路径匹配存在偏差

修正后的工作流YAML

name: First git action workflow
on:
  push:
    branches: ['main']
jobs:
  test:
    name: Test Example
    runs-on: ubuntu-latest
    steps:
      - name: checkout code
        uses: actions/checkout@v4

      - name: run test suite
        run: mvn test

      - name: verify report files (debug step)
        if: always()
        run: |
          ls -l ./report/  # 确认测试报告是否生成在这个路径下

      - name: upload test report
        if: always()
        uses: actions/upload-artifact@v4
        with:
          name: automation-report
          path: ./report/TestReport*.html

关键修改点说明

  • 移除手动创建report的步骤:测试套件会自动生成report文件夹,手动创建会导致你在空文件夹里执行ls -l,无法确认实际报告的位置
  • 更新action版本:将actions/checkout@v1和actions/upload-artifact@master替换为官方推荐的稳定版本(v4),避免兼容性问题
  • 调整artifact名称:将name: automationReport.html改为automation-report,artifact是文件集合的名称,不需要带后缀
  • 增加debug步骤:通过ls -l ./report/可以直观确认测试报告是否存在、文件名是否符合TestReport*.html的匹配规则

额外检查建议

如果修正后仍找不到文件,需要确认:

  • 测试套件生成的报告是否确实在项目根目录的report文件夹下(有些Maven插件会将报告输出到target/surefire-reports等路径)
  • 报告文件名是否严格符合TestReport_当前日期.html的格式,确保通配符*能正确匹配

内容的提问来源于stack exchange,提问作者abhijeet aute

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.02 10:56:10