【问题标题】:Jenkins: The result file for the metric 'JUnit' is not valid. The result file has been skipped. Report Contains Invalid XMLJenkins:度量“JUnit”的结果文件无效。结果文件已被跳过。报告包含无效的 XML
【发布时间】:2014-08-14 12:15:56
【问题描述】:

当 Jenkins 尝试通过 Junit 读取结果 xml 文件时出现此错误

这是输出

> 12:47:46 D:\BuildShare\HudsonSlave_SentraSAHI\workspace\SentraIntegrationTesting-LS-Chrome>exit
> 0  
> 12:47:46 [xUnit] [INFO] - Starting to record. 
> 12:47:46 [xUnit] [INFO] - Processing JUnit 
> 12:47:46 [xUnit] [INFO] - [JUnit] - 1 test report file(s) were found with the pattern 'SentraIntegrationTesting\SahiJUnitResults\TEST-*.xml' relative to 'D:\BuildShare\HudsonSlave_SentraSAHI\workspace\SentraIntegrationTesting-LS-Chrome' for the testing framework 'JUnit'. 
> 12:47:47 [xUnit] [ERROR] - The result file 'D:\BuildShare\HudsonSlave_SentraSAHI\workspace\SentraIntegrationTesting-LS-Chrome\SentraIntegrationTesting\SahiJUnitResults\TEST-Sentra_ExternalUrls_chrome.xml'
> for the metric 'JUnit' is not valid. The result file has been skipped.
> 12:47:47 [xUnit] [INFO] - Failing BUILD because 'set build failed if errors' option is activated. 
> 12:47:47 [xUnit] [INFO] - There are errors when processing test results. 
> 12:47:47 [xUnit] [INFO] - Skipping tests recording. 
> 12:47:47 [xUnit] [INFO] - Stop build.
> 12:47:47 Build step 'Publish xUnit test result report' changed build
> result to FAILURE

我的 XML 文件如下所示

<?xml version="1.0" encoding="UTF-8"?>
<testsuite errors="0" failures="0" name="Sentra_IntegrationTests.suite.Sentra_ExternalUrls" tests="1" time="173.162">
<testcase classname="Sentra_IntegrationTests.suite.Sentra_ExternalUrls" name="Sentra_ExternalUrls.sah" time="173.162">499Sentra_IntegrationTests__14Aug2014__02_14_57_872Sentra_IntegrationTests.suiteD:\BuildShare\HudsonSlave_SENTRASAHIO\workspace\SentraIntegrationTesting-LS-Oracle-Firefox\SentraIntegrationTesting/SahiScripts/Sentra_IntegrationTests.suite2014-08-14 02:14:57.8712014-08-14 05:19:56.273FAILURE4440411098402null
a=a
baseURL=http://SENTRASAHIO.TEST.LOCAL:8080/Sentra_Latest_Sources_MasterBuild_Oracle_Console/SentraSahi.html?locale=sq
browserOption=-profile C:\Progra~1\sahiPRO\userdata\browser\ff\profiles\sahi0 -no-remote
browserPath=C:\Program Files (x86)\Mozilla Firefox\firefox.exe
browserProcessName=firefox.exe
emailProp=
host=localhost
logsInfo=html:D:\BuildShare\HudsonSlave_SENTRASAHIO\workspace\SentraIntegrationTesting-LS-Oracle-Firefox\SentraIntegrationTesting\target\IntegrationTestResults\Sentra-Latest_Sources-2014-08-13_19-01-21_Build_520_all\2014-08-14_02-14-57,junit:D:\BuildShare\HudsonSlave_SENTRASAHIO\workspace\SentraIntegrationTesting-LS-Oracle-Firefox\SentraIntegrationTesting\SahiJUnitResults
port=9999
sahisid=sahi_b2763f4a05c8b04ec70a774077f99cdaf13d
suiteId=sahi_b2763f4a05c8b04ec70a774077f99cdaf13d
suiteName=Sentra_IntegrationTests.suite
suitePath=D:\BuildShare\HudsonSlave_SENTRASAHIO\workspace\SentraIntegrationTesting-LS-Oracle-Firefox\SentraIntegrationTesting/SahiScripts/Sentra_IntegrationTests.suite
suiteReportId=Sentra_IntegrationTests__14Aug2014__02_14_57_872
threads=1null000
</testcase>
</testsuite>

有什么想法吗? 谢谢 唐娜

【问题讨论】:

    标签: junit jenkins


    【解决方案1】:

    无法评论,所以要回答。 another post上好像有解释

    Jenkins 错误跟踪器中存在许多错误,这些错误涉及 xUnit 解析失败以及各种类似 JUnit 的输出。如果您使用 xUnit 可以理解的格式之一,xUnit 会很棒,但它对于解析由非 JUnit 工具生成的通用 JUnit 类输出不太好。根据我的经验,您最好使用内置的 Publish JUnit 测试结果报告构建后操作。

    JENKINS-18095 有一个指向 xUnit 用来验证 JUnit XML 的 XSD 的指针。基于此,我猜想您的 testcase 元素中的参数属性会触发 xUnit 验证。

    Dave Bacher

    回复

    感谢@Dave,我通过降级 xUnit 插件解决了我的问题,所以也许最新插件中存在错误? – user2043042 2013 年 10 月 3 日 11:33

    【讨论】:

      猜你喜欢
      • 2013-10-08
      • 2013-02-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-02-19
      相关资源
      最近更新 更多