简体   繁体   English

错误:步骤“发布JUnit测试结果报告”失败:找到了测试报告,但是没有一个是新的。 测试运行了吗?

[英]ERROR: Step ‘Publish JUnit test result report’ failed: Test reports were found but none of them are new. Did tests run?

<project basedir="." default="build" name="Calculator">
    <property environment="env"/>
    <property name="junit.output.dir" value="junit"/>
    <property name="debuglevel" value="source,lines,vars"/>
    <property name="target" value="1.8"/>
    <property name="source" value="1.8"/>
    <path id="JUnit 4.libraryclasspath">
        <pathelement location="../../../.p2/pool/plugins/org.junit_4.12.0.v201504281640/junit.jar"/>
        <pathelement location="../../../.p2/pool/plugins/org.hamcrest.core_1.3.0.v201303031735.jar"/>
    </path>
    <path id="Calculator.classpath">
        <pathelement location="bin"/>
        <path refid="JUnit 4.libraryclasspath"/>
    </path>
    <target name="init">
        <mkdir dir="bin"/>
        <copy includeemptydirs="false" todir="bin">
            <fileset dir="src">
                <exclude name="**/*.launch"/>
                <exclude name="**/*.java"/>
            </fileset>
        </copy>
    </target>
    <target name="clean">
        <delete dir="bin"/>
    </target>
    <target depends="clean" name="cleanall"/>
    <target depends="build-subprojects,build-project" name="build"/>
    <target name="build-subprojects"/>
    <target depends="init" name="build-project">
        <echo message="${ant.project.name}: ${ant.file}"/>
        <javac debug="true" debuglevel="${debuglevel}" destdir="bin" includeantruntime="false" source="${source}" target="${target}">
            <src path="src"/>
            <classpath refid="Calculator.classpath"/>
        </javac>
    </target>
    <target description="Build all projects which reference this project. Useful to propagate changes." name="build-refprojects"/>
    <target description="copy Eclipse compiler jars to ant lib directory" name="init-eclipse-compiler">
        <copy todir="${ant.library.dir}">
            <fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
        </copy>
        <unzip dest="${ant.library.dir}">
            <patternset includes="jdtCompilerAdapter.jar"/>
            <fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
        </unzip>
    </target>
    <target description="compile project with Eclipse compiler" name="build-eclipse-compiler">
        <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
        <antcall target="build"/>
    </target>
    <target name="AllTests">
        <mkdir dir="${junit.output.dir}"/>
        <junit fork="yes" printsummary="withOutAndErr">
            <formatter type="xml"/>
            <test name="CalculatorProject.AllTests" todir="${junit.output.dir}"/>
            <jvmarg line="-ea"/>
            <classpath refid="Calculator.classpath"/>
        </junit>
    </target>
    <target name="AdditionTest">
        <mkdir dir="${junit.output.dir}"/>
        <junit fork="yes" printsummary="withOutAndErr">
            <formatter type="xml"/>
            <test name="CalculatorProject.AdditionTest" todir="${junit.output.dir}"/>
            <jvmarg line="-ea"/>
            <classpath refid="Calculator.classpath"/>
        </junit>
    </target>
    <target name="Divide">
        <mkdir dir="${junit.output.dir}"/>
        <junit fork="yes" printsummary="withOutAndErr">
            <formatter type="xml"/>
            <test name="CalculatorProject.Divide" todir="${junit.output.dir}"/>
            <jvmarg line="-ea"/>
            <classpath refid="Calculator.classpath"/>
        </junit>
    </target>
    <target name="Multiply">
        <mkdir dir="${junit.output.dir}"/>
        <junit fork="yes" printsummary="withOutAndErr">
            <formatter type="xml"/>
            <test name="CalculatorProject.Multiply" todir="${junit.output.dir}"/>
            <jvmarg line="-ea"/>
            <classpath refid="Calculator.classpath"/>
        </junit>
    </target>
    <target name="SubtractTest">
        <mkdir dir="${junit.output.dir}"/>
        <junit fork="yes" printsummary="withOutAndErr">
            <formatter type="xml"/>
            <test name="CalculatorProject.SubtractTest" todir="${junit.output.dir}"/>
            <jvmarg line="-ea"/>
            <classpath refid="Calculator.classpath"/>
        </junit>
    </target>
    <target name="AllTestss">
        <mkdir dir="${junit.output.dir}"/>
        <junit fork="yes" printsummary="withOutAndErr">
            <formatter type="xml"/>
            <test name="CalculatorProject.AllTestss" todir="${junit.output.dir}"/>
            <jvmarg line="-ea"/>
            <classpath refid="Calculator.classpath"/>
        </junit>
    </target>
    <target name="junitreport">
        <junitreport todir="${junit.output.dir}">
            <fileset dir="${junit.output.dir}">
                <include name="TEST-*.xml"/>
            </fileset>
            <report format="frames" todir="${junit.output.dir}"/>
        </junitreport>
    </target>
</project>

Having the error while running my project and its Junit test in Jenkins. 在Jenkins中运行我的项目及其Junit测试时出错。 I also get an error "ERROR: Step 'Publish JUnit test result report' failed: None of the test reports contained any result". 我还收到一个错误“错误:步骤'发布JUnit测试结果报告'失败:没有任何测试报告包含任何结果”。 And also having a dependency issue with the test. 还有测试的依赖关系问题。 Tried a few solutions but did not work Any solutions? 尝试了一些解决方案,但没有用任何解决方案?

Make sure to clean your target folder before you start , it will be easier for you to understand. 确保在开始之前清洁目标文件夹,这将使您更容易理解。 looks like you have only old tests results. 看起来您只有旧的测试结果。

Thanks 谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM