Ben*_*Ben 18 ant junit jenkins jenkins-plugins
从jenkins收到的确切消息是:
No test report files were found. Configuration error?
Build step 'Publish JUnit test result report' changed build result to FAILURE
Run Code Online (Sandbox Code Playgroud)
配置JUnit测试结果报告插件时,在将"测试报告XML"路径输入为"/reports/TEST-*.xml"时,路径下方会显示以下错误:
'/reports/TEST-*.xml' doesn't match anything: '' exists but not '/reports/TEST-*.xml'
Run Code Online (Sandbox Code Playgroud)
我也试过使用完整路径但产生相同的结果.在这两种情况下,路径都应该选择/ reports目录中的"TESTS-TestSuites.xml"文件.
我不确定这是插件或生成的XML文件的问题.我也知道这可能是我编写的用于运行JUnit测试并生成XML结果文件的ant构建脚本的问题,因此我已经包含了下面的内容,以防需要更改某些内容:
<?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>
Run Code Online (Sandbox Code Playgroud)
我一直在研究这个问题一段时间,但没有找到任何解决方案,所以我将不胜感激任何帮助.谢谢.
Shi*_*mar 15
Jenkins从工作区根目录中查找路径.确保给定路径正确或使用通配符查看多个位置.尝试使用**/reports/TEST-*.xml
您确定报告文件夹位于工作区下方吗?如果测试结果文件确实存在于路径中给定的位置,请手动验证.
对于具有多种Gradle产品风格的Android项目,我使用以下路径Test report XMLs
:
**/build/test-results/**/TEST-*.xml
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
60048 次 |
最近记录: |