【问题标题】:Jenkins: The result file for the metric 'JUnit' is not valid. The result file has been skippedJenkins:度量“JUnit”的结果文件无效。结果文件已被跳过
【发布时间】:2013-10-08 21:56:11
【问题描述】:

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

有什么想法吗?

【问题讨论】:

    标签: xml maven junit jenkins


    【解决方案1】:

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

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

    【讨论】:

    • 谢谢@Dave,我通过降级xUnit插件解决了我的问题,所以也许最新插件中存在错误?
    • 你降级到哪个版本?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-06-11
    • 2013-02-02
    • 1970-01-01
    • 2012-09-03
    • 1970-01-01
    • 2012-03-18
    • 1970-01-01
    相关资源
    最近更新 更多