如何解决 Jenkins build error on recording test results?

How to solve Jenkins build error on recording test results?

在我的 Jenkins 构建的所有成功步骤之后,我收到一个错误:

记录测试结果

"ERROR: Publisher hudson.tasks.junit.JUnitResultArchiver aborted due to exception hudson.AbortException: No test report files were found. Configuration error?"

我试图在 Jenkins 文档和堆栈溢出中搜索答案,但是我没有找到任何答案。

如果您使用 behat3,请确保其版本支持 junit 格式化程序,因为在早期版本中缺少它 https://github.com/Behat/Behat/pull/676

同时检查您是否已在 behat.yml

配置配置文件

行为 2

jenkins:  
    formatter:
        name: pretty,junit
        parameters:
            output_path: ,build/logs/behat

行为 3

jenkins:
    formatters:
        junit: [build/log/behat]

另外 build.xml 必须将其命名为 "behat --profile jenkins"

我可能假设您已将测试结果路径配置为与 Jenkins 工作区无关(通常,这是您 运行 测试的目录)。 JUnit 结果 xml 路径应根据 Jenkins 工作区目录进行配置,这是您 xml 报告的根目录。