现在的位置: 首页 > 综合 > 正文

Ant With JUnit

2013年09月04日 ⁄ 综合 ⁄ 共 1097字 ⁄ 字号 评论关闭

Ant 与 JUnit 结合的一个例子

<project name="junitSample" default="test">
    
<target name="init">
        
<property name="outdir" value="/home/AD/temp/junitSample"/>
        
<property name="reportdir" value="./report/html"/>
    
</target>

    
<target name="prepare" depends="init">
        
<mkdir dir="${outdir}"/>
        
<mkdir dir="${reportdir}"/>
    
</target>

    
<target name="compile" depends="prepare">
        
<javac srcdir="./src" destdir="${outdir}" 
            classpath
="junit.jar"/>
    
</target>

    
<target name="test" depends="compile">
        
<junit printsummary="true">
            
<formatter type="xml"/>
            
<formatter type="plain"/>

            
<test name="junit.samples.AllTests"/>
            
<test name="xptoolkit.junit.example.HashMapTest"/>

            
<classpath>
                
<pathelement location="${outdir}"/>
            
</classpath>
        
</junit>

        
<junitreport todir="./report">
            
<fileset dir=".">
                
<include name="TEST-*.xml"/>
            
</fileset>

            
<report format="frames" todir="${reportdir}"/>
        
</junitreport>
    
</target>
</project>

 

抱歉!评论已关闭.