如何在ant junit任务中过滤xml格式化程序的内容?
我正在将junit测试用例与当前使用ant构建文件的项目集成。我添加了一些测试用例,它们作为构建过程的一部分运行得非常好。我需要生成junit的详细和相关的报告以及构建。在如何在ant junit任务中过滤xml格式化程序的内容?,junit,ant,formatter,Junit,Ant,Formatter,我正在将junit测试用例与当前使用ant构建文件的项目集成。我添加了一些测试用例,它们作为构建过程的一部分运行得非常好。我需要生成junit的详细和相关的报告以及构建。在内部,我正在使用。我面临以下问题: 如果我使用,它包含的信息非常有限 如果我使用问题1 考虑使用将生成的XML文件作为输入,并使用XSLT生成另一个XML文件作为输出 有关使用XSLT生成其他文件的示例,请参见 问题2 不需要在传递给的上指定ant-x.x.x.jar或ant-junit-x.x.jar 对于,默认情况下,in
内部,我正在使用
。我面临以下问题:
,它包含的信息非常有限问题1
考虑使用将
生成的XML文件作为输入,并使用XSLT生成另一个XML文件作为输出
有关使用XSLT生成其他文件的示例,请参见
问题2
不需要在传递给
的
上指定ant-x.x.x.jar
或ant-junit-x.x.jar
对于
,默认情况下,includeantruntime
为true
。这意味着ant-x.x.jar
和ant-junit-x.x.jar
将已经位于为分叉junit进程提供的类路径上
从
中删除ant-x.x.x.jar
和ant-junit-x.x.jar
将避免在junit
警告路径中检测到多个版本的ant。将尝试将其设置为true
。我没有得到第一个答案。我从未使用过XSTL
,那么如何在ant文件中使用junitreport
或XSTL
?我已经更新了我的ant代码。我可以在框架中获取报告和系统属性。。。将尝试使用定制XSTL…在许多地方,我已经看到了@*|b/*
,b/*
这意味着什么?@Amberberberiwalb/*
的意思是什么匹配名为
的元素的属性。例如,在XML片段
中,b/*
匹配了两个
元素的b1
和b2
属性。好的..现在我明白了..谢谢老兄..你的回答确实帮助我快速得到了结果。
<target name="unit_testing" depends="binary" description="Unit Testing">
<!-- Compile the java code from ${src} into ${build_main} -->
<javac srcdir="${codebase_test}" destdir="${build_test}"
encoding="cp1252" includeantruntime="false"
bootclasspath="C:/Program Files (x86)/Java/jdk1.5.0_07/jre/lib/rt.jar;C:/Program Files/Java/jdk1.5.0_07/jre/lib/rt.jar;"
source="1.5" target="1.5">
<classpath refid="classpath_main" />
<classpath refid="classpath_test" />
<classpath>
<pathelement location="${binary}/binary_x.x.x.jar" />
</classpath>
</javac>
<junit fork="yes" haltonfailure="yes">
<!-- set useFile="true" if output required in files -->
<formatter type="xml" usefile="true" />
<classpath refid="classpath_main" />
<classpath refid="classpath_test" />
<classpath>
<pathelement path="${build_test}" />
<pathelement location="${binary}/binary_x.x.x.jar" />
</classpath>
<batchtest todir="${results_test}">
<fileset dir="${build_test}">
<include name="**/*Test.class" />
</fileset>
</batchtest>
</junit>
</target>