Jenkins:度量标准'JUnit'的结果文件无效。结果文件已被跳过。报告包含无效的XML

时间:2014-08-14 12:15:56

标签: junit jenkins

当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>

有什么想法吗? 谢谢 娜

1 个答案:

答案 0 :(得分:0)

无法评论,所以要回答。看起来有another post

的解释
  

Jenkins bug跟踪器中有很多关于xUnit解析失败的错误,它们具有各种类似JUnit的输出。如果你使用它理解的格式之一,xUnit很棒,但它不太适合解析非JUnit工具生成的类似JUnit的通用输出。根据我的经验,您最好使用内置的Publish JUnit测试结果报告构建后操作。

     

JENKINS-18095有一个指向XSD的指针,xUnit用它来验证JUnit XML。基于此,我猜测你的testcase元素中的参数属性正在绊倒xUnit验证。

     

Dave Bacher

效应初探

  

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