使用JUnit&Ant生成UT报表
2013-02-02 18:00
267 查看
1. JUnit Test Case测试类需要从TestCase类继承
2. Ant的配置文件如下,添加一个target用来run JUnit并生成报表
<project default="report" basedir=".">
<target name="runtests">
<java fork="yes" classname="junit.textui.TestRunner"
taskname="junit" failonerror="true">
<arg value="unitTest.calculation.CalculationTest"/>
<classpath>
<pathelement location="Test.jar" />
<pathelement path="" />
</classpath>
</java>
</target>
<target name="report">
<junit printsummary="yes" fork="yes" haltonfailure="no" >
<classpath>
<fileset dir="../">
<include name="Test.jar" />
<include name="lib/test/hamcrest-core-1.1.jar" />
</fileset>
</classpath>
<formatter type="xml"/>
<test name="unitTest.calculation.calculationTest" todir="../report" />
</junit>
<junitreport todir="../report/html">
<fileset dir="../report">
<include name="TEST-unitTest.calculation.calculationTest.xml"/>
</fileset>
<report format="frames" todir="../report/html"/>
</junitreport>
</target>
</project>
3. 执行Ant生成一个html形式的报表
2. Ant的配置文件如下,添加一个target用来run JUnit并生成报表
<project default="report" basedir=".">
<target name="runtests">
<java fork="yes" classname="junit.textui.TestRunner"
taskname="junit" failonerror="true">
<arg value="unitTest.calculation.CalculationTest"/>
<classpath>
<pathelement location="Test.jar" />
<pathelement path="" />
</classpath>
</java>
</target>
<target name="report">
<junit printsummary="yes" fork="yes" haltonfailure="no" >
<classpath>
<fileset dir="../">
<include name="Test.jar" />
<include name="lib/test/hamcrest-core-1.1.jar" />
</fileset>
</classpath>
<formatter type="xml"/>
<test name="unitTest.calculation.calculationTest" todir="../report" />
</junit>
<junitreport todir="../report/html">
<fileset dir="../report">
<include name="TEST-unitTest.calculation.calculationTest.xml"/>
</fileset>
<report format="frames" todir="../report/html"/>
</junitreport>
</target>
</project>
3. 执行Ant生成一个html形式的报表
相关文章推荐
- 使用ant 跑junit test 生成 report
- 使用ant进行junit,并生成report
- Maven与Ant使用reportNG代替testng生成的报表
- 使用gvim && txt2tags生成google code wiki 格式文件
- VS"后生成事件" 菜单的使用
- Android项目使用Ant打包,生成build.xml
- 利用ant进行自动化测试junit并生成报告
- 使用Mybatis Generator结合Ant脚本快速自动生成Model、Mapper等文件的方法
- 如何使用iReport 和jasper生成报表(SQL传参数及中文文件名)
- 在.NET中不安装Office使用EPPlus生成带图表(Chart)的Excel报表
- Android项目使用Ant打包,自动生成build.xml
- android中使用TextView来显示某个网址的内容,使用<ScrollView>来生成下拉列表框
- C#.net使用DotNetCharting控件生成报表统计图--A
- birt使用quartz框架实现自动生成报表
- 5.2.1 使用Ant自动生成CHM格式的javadoc失败
- 基于JUnit和Ant测试程序正在运行使用Kieker(AspectJ)监测方法
- 使用google chart api生成报表图片
- ANT的使用(结合JUNIT、SVN)
- android 使用ant打包或者生成jar
- 使用ant进行android开源voip工程sipdroid的编译与apk生成