Jenkins: 指标“JUnit”的结果文件无效。结果文件已被跳过。

7
当Jenkins尝试通过Junit读取结果XML文件时,我遇到了这个错误。
这是输出内容。
> [xUnit] [INFO] - Starting to record.
[xUnit] [INFO] - Processing JUnit
[xUnit] [INFO] - [JUnit] - 1 test report file(s) were found with the pattern '**\testResults\*.xml' relative to 'C:\Jenkins\jobs\InstantMatcher\workspace' for the testing framework 'JUnit'.
[xUnit] [ERROR] - The result file 'C:\Jenkins\jobs\InstantMatcher\workspace\Code\RegressionTest\testResults\result-InstantMatcher - Copy.xml' for the metric 'JUnit' is not valid. The result file has been skipped.
[xUnit] [INFO] - Fail BUILD because 'set build failed if errors' option is activated.
[xUnit] [INFO] - There are errors when processing test results.
[xUnit] [INFO] - Skipping tests recording.
[xUnit] [INFO] - Stop build.
Finished: FAILURE

我的XML文件看起来像这样:
 <testsuite failures="0" tests="209" name="UnitTests.MainClassTest">
    <testcase classname="UnitTests.OSUtils" name="stripExtension" parameters="" assertions="pass" time="0.03 ms"/>
        <testcase classname="UnitTests.OSUtils" name="changeExtension" parameters="" assertions="pass" time="0.04 ms"/>
        <testcase classname="UnitTests.OSUtils" name="stripPathAndExtension" parameters="" assertions="pass" time="0.04 ms"/>
        <testcase classname="UnitTests.OSUtils" name="getFilename" parameters="" assertions="pass" time="0.03 ms"/>
        <testcase classname="UnitTests.OSUtils" name="atoi" parameters="" assertions="pass" time="0.47 ms"/>
        <testcase classname="UnitTests.CImage" name="jpg matches bmp" parameters="" assertions="pass" time="N/A"/>
        <testcase classname="UnitTests.InstantMatcher" name="Bandpass Sync: " parameters="" assertions="pass" time="109.73 ms"/>
        <testcase classname="UnitTests.InstantMatcher" name="Orientation Dominance Sync: " parameters="" assertions="pass" time="109.73 ms"/>
        <testcase classname="UnitTests.InstantMatcher" name="Test Saliency MapSync: " parameters="" assertions="pass" time="109.73 ms"/>
        <testcase classname="UnitTests.InstantMatcher" name="Test Level Keypoints Sync: " parameters="" assertions="pass" time="109.73 ms"/>
        <testcase classname="UnitTests.InstantMatcher" name="Bandpass Sync: " parameters="" assertions="pass" time="109.73 ms"/>
        <testcase classname="UnitTests.InstantMatcher" name="Orientation Dominance Sync: " parameters="" assertions="pass" time="109.73 ms"/>
        <testcase classname="UnitTests.InstantMatcher" name="Test Saliency MapSync: " parameters="" assertions="pass" time="109.73 ms"/>
        <testcase classname="UnitTests.InstantMatcher" name="Test Level Keypoints Sync: " parameters="" assertions="pass" time="109.73 ms"/>
        <testcase classname="UnitTests.InstantMatcher" name="Bandpass Sync: " parameters="" assertions="pass" time="109.73 ms"/>
        <testcase classname="UnitTests.InstantMatcher" name="Orientation Dominance Sync: " parameters="" assertions="pass" time="109.73 ms"/>
        <testcase classname="UnitTests.InstantMatcher" name="Test Saliency MapSync: " parameters="" assertions="pass" time="109.73 ms"/>
        <testcase classname="UnitTests.InstantMatcher" name="Test Level Keypoints Sync: " parameters="" assertions="pass" time="109.73 ms"/>
        <testcase classname="UnitTests.InstantMatcher" name="Bandpass Sync: " parameters="" assertions="pass" time="109.73 ms"/>

任何想法请?
1个回答

12

在Jenkins的bug跟踪器中,有许多关于xUnit解析各种类似JUnit输出的失败bug。如果您使用xUnit了解其中一种格式,则它非常好用,但对于由非JUnit工具生成的通用JUnit-like输出进行解析则不太好用。根据我的经验,最好使用内置的发布JUnit测试结果报告后构建操作。

JENKINS-18095指向了xUnit用于验证JUnit XML的XSD。基于此,我猜测您testcase元素中的parameters属性会导致xUnit验证失败。


谢谢@Dave,我通过降级xUnit插件解决了我的问题,所以也许最新的插件存在一个bug? - Junaid Awan
1
你降级到了哪个版本? - Opal

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接