【问题标题】:Jenkins xUnit test result reportJenkins xUnit 测试结果报告
【发布时间】:2016-05-03 12:52:13
【问题描述】:

我有一份 Jenkins 工作,将一些测试报告 (XML) 复制到本地并通过 xUnit 将它们转换为 JUnit 报告。

问题是没有失败或跳过的测试,但我总是得到

    [xUnit] [INFO] - Check 'Failed Tests' threshold.
    [xUnit] [INFO] - Check 'Skipped Tests' threshold.
    [xUnit] [INFO] - Setting the build status to FAILURE
    [xUnit] [INFO] - Stopping recording.
    Finished: FAILURE

是什么原因造成的?

【问题讨论】:

  • 有检测结果吗?如果没有结果,xUnit 发布者可能会配置为失败。这是您构建中唯一的 xUnit 输出吗?什么是构建配置?你有什么版本的 xUnit 插件?
  • @Dave Bacher 这是奇怪的部分。我确实有测试结果,这是相当大的文件集。在获得这些 xml 报告后,我尝试使用 xUnit 来发布它们。詹金斯的工作以前可以正常工作,但最近却失败了。我不知道发生了什么。
  • 我遇到了同样的问题,我通过 Bash 脚本触发了单元测试的运行(以及 xml 结果文件的创建),脚本返回 1this 导致构建失败,[xUnit] [INFO] - Setting the build status to FAILURE 行具有误导性,因为它没有将构建设置为失败,我的脚本的返回代码已经将构建设置为失败.我相信它只是反映构建的当前状态。
  • 对我来说也是一样,在你的输出之前我还有 3 行。他们是[xUnit] [INFO] - Starting to record. [xUnit] [INFO] - Processing JUnit [xUnit] [INFO] - [JUnit] - 1 test report file(s) were found with the pattern 'nosetests.xml' relative to '/home/jenkins/workspace/mts-pipeline-quality' for the testing framework 'JUnit'.

标签: jenkins junit xunit threshold


【解决方案1】:

在我之前的项目中,我管理着 3 个开发团队和 4 个解决方案,它们共同组成了一个集成平台,所有这些都在一个 Jenkins Master 上。

我有 2 个 DOS 批处理文件,它们保存在每个解决方案根目录下的 JenkinsScripts/ 子目录中。一个叫做 CodeCoverage.bat(它确保 OpenCover 和 ReportGenerator 监视单元测试),它又调用 RunUnitTests.bat 传递参数。

在 RunUnitTests.bat 中,包含许多参数的关键行解析为:

packages\xunit.runner.console.2.1.0\tools\xunit.console.exe <MyUnitTestProject.dll> -nologo -noshadow -nunit TestReports\TestResults.xml

因此,我将 XUnit 结果 XML 转换为 NUnit 结果 XML,并使用 NUnit 插件发布结果。

自从我使用这种方法以来,将 XUnit 和 NUnit 3 XML 映射到对 Jenkins 友好的 JUnit 的选项(在我的请求下)得到了改进。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-06
    • 1970-01-01
    • 1970-01-01
    • 2018-08-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多