Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/331.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
Java 单元测试中的回波不显示_Java_Ant - Fatal编程技术网

Java 单元测试中的回波不显示

Java 单元测试中的回波不显示,java,ant,Java,Ant,我有一个ant项目,我在其中添加了AntUnitTest。这是执行测试的目标 <target name="test-build" depends="init-build"> <au:antunit> <fileset file="test.xml"/> <au:plainlistener/> <au:xmllistener todir="${reports.antunit.dir}"/&

我有一个ant项目,我在其中添加了AntUnitTest。这是执行测试的目标

<target name="test-build" depends="init-build">
    <au:antunit>
        <fileset file="test.xml"/>
        <au:plainlistener/>
        <au:xmllistener todir="${reports.antunit.dir}"/>
    </au:antunit>
</target>

我见过echo在其他项目中使用,例如。如何让echo在单元测试中工作?

捕获
echo
任务的输出,以便对其使用断言(即
assertLogContains
)。在props中,当您在antunit之外手动运行目标时,它看起来好像有回声

如果要查看
echo
的输出,需要将
logforwarder
testlistener添加到
antunit
任务中,即

<au:antunit>
    <fileset file="test.xml"/>
    <au:plainlistener/>
    <au:xmllistener todir="${reports.antunit.dir}"/>
    <au:logforwarder/>
</au:antunit>

您的
echo
任务的输出被捕获,以便您可以对其使用断言(即
assertLogContains
)。在props中,当您在antunit之外手动运行目标时,它看起来好像有回声

如果要查看
echo
的输出,需要将
logforwarder
testlistener添加到
antunit
任务中,即

<au:antunit>
    <fileset file="test.xml"/>
    <au:plainlistener/>
    <au:xmllistener todir="${reports.antunit.dir}"/>
    <au:logforwarder/>
</au:antunit>


我还没有尝试过这个,但我相信它会起作用。我还发现了显示所有断言宏的antlib.xml。这对试图学习antunit的人很有帮助。也感谢您参与antunit的开发!不客气。如果您从Apache(或其镜像之一)下载AntUnit发行版,它还包含一本手册。出于某种原因,我们仍然希望这是默认的分发点,所以不要费心把手册放到网上。哦,那太好了。我用常春藤来安装这个装置。这就是这个项目。github.com/moaxcp/gradle-to-antas该手册基本上包含静态HTML,您可以在中找到它,谢谢。这是一个很大的帮助。这将是很好的,有在生长激素的网页上发表。我还没有能够尝试这个,但我相信它会工作。我还发现了显示所有断言宏的antlib.xml。这对试图学习antunit的人很有帮助。也感谢您参与antunit的开发!不客气。如果您从Apache(或其镜像之一)下载AntUnit发行版,它还包含一本手册。出于某种原因,我们仍然希望这是默认的分发点,所以不要费心把手册放到网上。哦,那太好了。我用常春藤来安装这个装置。这就是这个项目。github.com/moaxcp/gradle-to-antas该手册基本上包含静态HTML,您可以在中找到它,谢谢。这是一个很大的帮助。这将是很好的,有发表在gh页。
<au:antunit>
    <fileset file="test.xml"/>
    <au:plainlistener/>
    <au:xmllistener todir="${reports.antunit.dir}"/>
    <au:logforwarder/>
</au:antunit>