Jenkins:指标"JUnit"的结果文件无效.结果文件已被跳过 [英] Jenkins: The result file for the metric 'JUnit' is not valid. The result file has been skipped

查看:89
本文介绍了Jenkins:指标"JUnit"的结果文件无效.结果文件已被跳过的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am getting this error when Jenkins tries to read the result xml file through Junit

这是输出

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

请问有什么主意吗?

推荐答案

Jenkins错误跟踪器中存在许多与xUnit解析失败有关的错误,这些错误与各种类似JUnit的输出有关.如果您使用xUnit可以理解的一种格式,则xUnit很棒,但是对于解析由非JUnit工具生成的类似于JUnit的通用输出而言,xUnit效果不好.以我的经验,最好使用内置的 Publish JUnit测试结果报告构建后操作.

There are numerous bugs in the Jenkins bug tracker regarding xUnit parsing failures with various JUnit-like output. xUnit is great if you're using one of the formats it understands, but it's less good for parsing generic JUnit-like output generated by a non-JUnit tool. In my experience, you're better off using the built in Publish JUnit test results report post-build action.

JENKINS-18095 具有指向XSD.基于此,我猜想testcase元素中的parameters属性正在使xUnit验证失败.

JENKINS-18095 has a pointer to the XSD that xUnit uses to validate the JUnit XML. Based on that, I would guess that the parameters attribute in your testcase element is tripping up the xUnit validation.

这篇关于Jenkins:指标"JUnit"的结果文件无效.结果文件已被跳过的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆