Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ant 显示空值的JUnit报告_Ant_Junit - Fatal编程技术网

Ant 显示空值的JUnit报告

Ant 显示空值的JUnit报告,ant,junit,Ant,Junit,我正在使用JUnitReport和Ant生成测试用例报告。 生成文件成功运行,但显示空值。就像在样式表中一样,我看到框架输出 测试0 失败0 成功率 时间0.00 这是我的build.xml文件 <project name="JunitTest" default="test" basedir="."> <property name="testdir" location="./bin" /> <property name="srcdir" location="

我正在使用JUnitReport和Ant生成测试用例报告。 生成文件成功运行,但显示空值。就像在样式表中一样,我看到框架输出

  • 测试0
  • 失败0
  • 成功率
  • 时间0.00
这是我的build.xml文件

<project name="JunitTest" default="test" basedir="."> 
<property name="testdir" location="./bin" /> 
<property name="srcdir" location="." /> 
<property name="full-compile" value="true" /> 
<property name="test.reports" value="./reports" />

<path id="classpath.base"/>
<path id="classpath.test">

<path id="JUnit 4.libraryclasspath">
      <pathelement location="./lib/junit-4.1.jar"/>
      <pathelement location=".lib/hamcrest-core-1.3.jar"/>
</path>

<pathelement location="${testdir}" />
<pathelement location="${srcdir}" />

<path refid="classpath.base" />

</path> 

<target name="clean" >
    <echo> CLEAN </echo>
    <delete verbose="${full-compile}"> 
        <fileset dir="${testdir}" includes="**/*.class" />
    </delete> 
</target>

<target name="compile" depends="clean">
    <echo> COMPILING </echo>
    <javac srcdir="${srcdir}" destdir="${testdir}" verbose="${full-compile}" >
        <classpath refid="classpath.test"/>
        <classpath refid="JUnit 4.libraryclasspath" />
    </javac>
</target>

<target name="test" depends="compile" >

    <junit printsummary="true" showoutput="true">
        <classpath refid="classpath.test" />
        <classpath refid="JUnit 4.libraryclasspath" />
        <formatter type="plain"  />
        <formatter type="plain"  />

        <test name="com.megacorp.projx.JUnit.AllTests" />
    </junit>

    <junitreport todir="${test.reports}" >
        <fileset dir="${test.reports}">
            <include name="TEST-*.xml" />
        </fileset>
        <report todir="${test.reports}"  format="frames" />
    </junitreport>
    <record name="${test.reports}/test-output.txt" action="start"/>
</target>

清洁的
编撰

请在
测试中设置todir属性

<test name="com.megacorp.projx.JUnit.AllTests"  todir="${test.reports}" />


如果您正在学习junit ant任务,请检查
batchtest
任务。它可以根据过滤器拾取测试。

您的junit不使用test.reports属性。TEST-*xml到哪里去了?我正在使用TEST.report属性。我已经在我的项目目录下创建了文件夹命名报告,junit在其中创建了所有html文件,但所有值均为0。此外,在reports TESTS-TestSuites.xml文件夹下创建的文件为空。