【问题标题】:How to print debug messages with Junit ant task?如何使用 Junit ant 任务打印调试消息?
【发布时间】:2013-11-28 09:32:50
【问题描述】:

考虑以下junit ant 目标,为便于阅读而进行了删节:

<target name="junit-tests" depends="clean, compile-tests">
    <junit fork="true" showoutput= ...>

        <classpath>...</classpath>
        <formatter.../>
        <jvmarg value=.../>

        <echo message="${test.dist.dir}"/>

        <batchtest todir=...>
            <fileset dir="${test.dist.dir}">
                <include name="**/*Junit.class"/>
            </fileset>
        </batchtest>
    </junit>
</target>       

为了获得test.dist.dir 变量的详细调试输出,我从build.xml 文件中的另一个目标复制了以下行:

<echo message="${test.dist.dir}"/>

但在 junit 测试目标中,它失败了:

build.xml:94: junit doesn't support the nested "echo" element.

如何打印 Junit ant 任务的调试输出?

【问题讨论】:

    标签: xml ant junit verbosity debug-print


    【解决方案1】:

    放在&lt;junit&gt;元素之前:

    <target name="junit-tests" depends="clean, compile-tests">
        <echo message="${test.dist.dir}"/>
        <junit fork="true" showoutput= ...>...
    

    因为变量的值不能改变,所以没有必要把它移进去。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-18
      • 1970-01-01
      • 2013-04-10
      • 2012-05-31
      相关资源
      最近更新 更多