JUnit测试不在Jenkins中执行

时间:2016-07-19 06:33:20

标签: jenkins junit ant

我之前从未使用像Jenkins这样的东西。我想用Jenkins进行自动化测试,但我总是得到错误:

  

错误:Step'VeröffentlicheJUnit-Testergebnisse。'失败:Keine   JUnit-Testergebnisse gefunden。 Liegt vielleicht ein   Konfigurationsfehler vor?完成:失败

这意味着:my $test_name = "George"; for my $son (keys %sons) { if ($son eq $test_name) { print "At least one family has a son named $test_name.\n"; last; } }

这是我的Ant Build XML文件:

Step 'Publish JUnit-Test results.' failed:No JUnit- Test results found.

这是控制台输出:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="." default="compile" name="HelloWorld">
<property environment="env"/>
<property name="junit.output.dir" value="junit"/>
<property name="debuglevel" value="source,lines,vars"/>
<property name="target" value="1.2"/>
<property name="source" value="1.3"/>
<path id="JUnit 3.libraryclasspath">
    <pathelement location="../../../../usr/share/eclipse/dropins/jdt/plugins/org.junit_3.8.2.dist/junit.jar"/>
</path>
<path id="HelloWorld.classpath">
    <pathelement location="bin"/>
    <path refid="JUnit 3.libraryclasspath"/>
</path>
<target name="init">
    <mkdir dir="bin"/>
    <copy includeemptydirs="false" todir="bin">
        <fileset dir="src">
            <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="compile"/>
<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="HelloWorld.classpath"/>
    </javac>
</target>
<target description="Build all projects which reference this project. Useful to propagate changes." name="build-refprojects"/>
<target name="run">
    <java classname="HelloWorld" failonerror="true" fork="yes">
        <classpath refid="HelloWorld.classpath"/>
    </java>
</target>
<target name="Test (1)">
    <mkdir dir="${junit.output.dir}"/>
    <junit fork="yes" printsummary="withOutAndErr">
        <formatter type="xml"/>
        <test name="Test" todir="${junit.output.dir}"/>
        <classpath refid="HelloWorld.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>   

我该怎么做?

0 个答案:

没有答案