Java

本类阅读TOP10

·使用MyEclipse开发Struts框架的Hello World!(录像1)
·hibernate配置笔记
·AOP编程入门--Java篇
·linux下Tomcat 5.0.20 与 Apache 2 安装/集成/配置
·在win2003下整合了整合Tomcat5.5+ apache_2.0.53+ mod_jk_2.0.47.dll
·构建Linux下IDE环境--Eclipse篇
·Jsp 连接 mySQL、Oracle 数据库备忘(Windows平台)
·ASP、JSP、PHP 三种技术比较
·Tomcat5.5.9的安装配置
·AWT GUI 设计笔记(二)

分类导航
VC语言Delphi
VB语言ASP
PerlJava
Script数据库
其他语言游戏开发
文件格式网站制作
软件工程.NET开发
JUnit和ant结合

作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站

JUnit和ant结合
cherami 转贴 

ant 提供了两个 target : junit 和 junitreport  
运行所有 测试用例 ,并生成 html 格式的报表 
具体操作如下: 

1.将 junit.jar 放在 ANT_HOME\lib 目录下 
2.修改 build.xml ,加入如下 内容: 

    <property name="report" value="report" /> 

    <target name="junitreport" depends="clean, compile"
        <junit printsummary="on" 
                fork="true" 
                haltonfailure="false" 
                failureproperty="tests.failed" 
                showoutput="true"
            <classpath refid="myclasspath"/> 
            <formatter type="xml"/> 
            <batchtest todir="${report}"
                <fileset dir="${build}"
                    <include name="**/*Test.*"/> 
                </fileset> 
            </batchtest> 
        </junit> 
        <junitreport todir="${report}"
            <fileset dir="${report}"
                <include name="TEST-*.xml"/> 
            </fileset> 
            <report format="frames" todir="${report}"/> 
        </junitreport> 
        <fail if="tests.failed"
            --------------------------------------------------------- 
            One or more tests failed, check the report for detail... 
            --------------------------------------------------------- 
        </fail> 
    </target> 

运行 这个 target ,ant 会运行每个 TestCase  
在 report 目录下就有了 很多 TEST*.xml 和 一些网页 
打开 report 目录下的 index.html 就可以看到很直观的测试运行报告,一目了然。



相关文章

相关软件