Jenkins JUnit测试结果报告插件指出找不到JUnit xml文件吗? [英] Jenkins JUnit Test Result Report plugin states that the JUnit xml file is not found?

查看:107
本文介绍了Jenkins JUnit测试结果报告插件指出找不到JUnit xml文件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从詹金斯收到的确切消息是:

The exact message received from jenkins is:

No test report files were found. Configuration error?
Build step 'Publish JUnit test result report' changed build result to FAILURE

在配置JUnit测试结果报告插件时,在将测试报告XML"路径输入为"/reports/TEST-*.xml"时,该路径下方显示以下错误:

When configuring the JUnit Test Result Report plugin, on entering the 'Test Report XMLs' path as '/reports/TEST-*.xml', the following error is displayed beneath the path:

'/reports/TEST-*.xml' doesn't match anything: '' exists but not '/reports/TEST-*.xml'

我也尝试过使用完整路径,但这会产生相同的结果.在这两种情况下,路径都应该拾取/reports目录中存在的"TESTS-TestSuites.xml"文件.

I have tried using the full path as well but that produces the same result. In both cases the paths should have picked up the 'TESTS-TestSuites.xml' file that was present in the /reports directory.

我不确定这是插件还是XML文件出现问题.我还知道,我编写的用于运行JUnit测试并生成XML结果文件的ant构建脚本可能存在问题,因此,在需要更改某些内容的情况下,我将其包括在下面:

I'm not sure whether this is a problem with the plugin or the XML file being generated. I'm also aware that it could be an issue with the ant build script that I have written to run the JUnit tests and produce the XML result file therefore I have included the contents of this below in case something needs to be changed:

<?xml version="1.0" encoding="utf-8"?>
<project name="jenkins-tests" basedir="." default="linux">

<property name="junit.output.dir" value="output"/>
<property name="src.dir" value="src"/>
<property name="lib.dir" value="libs" />
<property name="bin.dir" value="bin" />
<property name="full-compile" value="true" />

<path id="classpath.base"/>

<path id="classpath.test">
    <pathelement location="${bin.dir}" />
    <pathelement location="${src.dir}" />
    <pathelement location="${lib.dir}" />
    <pathelement location="${lib.dir}/junit.jar" />
    <path refid="classpath.base" />
</path>

<target name="clean" description="Clean up build artefacts">
    <delete dir="${basedir}/${junit.output.dir}" />
</target>

<target name="prepare" depends="clean" description="Prepare for build">
    <mkdir dir="${basedir}/${junit.output.dir}" />
    <mkdir dir="${junit.output.dir}/reports"/> 
</target>

<target name="compile" depends="prepare">
    <javac srcdir="${src.dir}" destdir="${bin.dir}" verbose="${full-compile}" includeAntRuntime="false" >
        <classpath refid="classpath.test"/>
    </javac>
</target>

<target name="test" depends="compile">
    <junit printsummary="true" haltonfailure="false">
        <formatter type="xml" usefile="true"/>
        <classpath refid="classpath.test" />
        <batchtest fork="yes" todir="${junit.output.dir}">
            <fileset dir="${src.dir}">
                <include name="*.java"/>
            </fileset>
        </batchtest>
    </junit>
</target>

<target name="test-reports" depends="test">
    <junitreport tofile="TESTS-TestSuites.xml" todir="${junit.output.dir}/reports">
        <fileset dir="${junit.output.dir}">
            <include name="TEST-*.xml" />
        </fileset>
        <report format="frames" todir="${junit.output.dir}/reports" />
    </junitreport>
</target>
</project>

我已经在研究这个问题已有一段时间了,但是没有找到任何解决方案,因此我将不胜感激.谢谢.

I've been researching into this problem for a while now and haven't found any solution so I would appreciate any help. Thanks.

推荐答案

Jenkins从工作空间的根目录中查找路径.确保给定的路径正确,或使用通配符在多个位置查找.尝试使用**/reports/TEST-*.xml 您确定报告"文件夹位于工作空间的正下方吗?手动验证测试结果文件是否确实在路径中指定的位置中.

Jenkins looks for the path from the workspace root. Ensure that the given path is correct or use wildcards to look in multiple locations. Try using **/reports/TEST-*.xml Are you sure the reports folder is right under the workspace? Verify manually if the test result files are indeed present in the location given in the path.

这篇关于Jenkins JUnit测试结果报告插件指出找不到JUnit xml文件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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