看標題就知道
下載下面的build
文件內容
<project default=
<!– =================================================================== –>
<!– Definitions –>
<!– =================================================================== –>
<property name=
<property name=
<property name=
<property name=
<property name=
<property name=
<property name=
<property name=
<property name=
<property name=
<property name=
<property name=
<property name=
<property name=
<property name=
<path id=
<pathelement location=
<fileset id=
<include name=
</fileset>
</path>
<!– include the cobertura building jars –>
<path id=
<path refid=
</path>
<!– define the cobertura property file –>
<taskdef classpat resource=
<!– =================================================================== –>
<!– Project Targets –>
<!– =================================================================== –>
<target name=
<!– create the output folder –>
<mkdir dir=
<mkdir dir=
<copy todir=
<fileset dir=
</copy>
</target>
<target name=
<javac srcdir=
<classpath refid=
</javac>
</target>
<!– =================================================================== –>
<!– Unit Test Targets –>
<!– =================================================================== –>
<!–
target: init
initialize the build env
<target name=
<!– create the output folder –>
<mkdir dir=
<mkdir dir=
<mkdir dir=
</target>
<!–
target: compile
compile the test cases
<target name=
<javac srcdir=
<classpath refid=
</javac>
</target>
<!– =================================
target: test
run the unit test
================================= –>
<target name=
<junit fork=
<sysproperty key=
file=
<classpath location=
<classpath refid=
<formatter type=
<batchtest todir=
<fileset dir=
<include name=
<exclude name=
</fileset>
</batchtest>
</junit>
<junitreport todir=
<fileset dir=
<include name=
</fileset>
<report format=
</junitreport>
</target>
<!– =================================================================== –>
<!– Code Coverage Targets –>
<!– =================================================================== –>
<!–
target: init
initialize the build env
<target name=
<!– create the output folder –>
<mkdir dir=
<mkdir dir=
<mkdir dir=
<mkdir dir=
</target>
<target name=
<javac srcdir=
<classpath refid=
</javac>
</target>
<!– =================================
target: instrument
Instrument into the class files
exclude test classes
================================= –>
<target name=
<!–
Instrument the application classes
instrumented classes into ${instrumented
–>
<cobertura
<!–
The following line causes instrument to ignore any
source line containing a reference to log
purposes of coverage reporting
–>
<ignore regex=
<fileset dir=
<!–
Instrument all the application classes
don
–>
<include name=
<exclude name=
</fileset>
</cobertura
</target>
<!– =================================
target: coverage
check the code coverage by given rates
================================= –>
<target name=
<cobertura
</target>
<!– =================================
target: coverage
generate code coverage report by xml format
================================= –>
<target name=
<!– Generate an XML file containing the coverage data using the
<cobertura
</target>
<!– =================================
target: coverage
generate code coverage report by html format
================================= –>
<target name=
<!–
Generate a series of HTML files containing the coverage
data in a user
–>
<cobertura
<fileset dir=
<include name=
</fileset>
</cobertura
</target>
<!– run the code coverage individual –>
<target name=
description=
<!– =================================================================== –>
<!– Public Targets –>
<!– =================================================================== –>
<target name=
<delete quiet=
<fileset dir=
<exclude name=
<exclude name=
</fileset>
<fileset dir=
</fileset>
</delete>
</target>
<!– =================================================================== –>
<!– Global Targets –>
<!– =================================================================== –>
<target name=
<target name=
<target name=
</project>
作者: Cherami
原載: Ant+JUnit+Cobertura
版權所有
From:http://tw.wingwit.com/Article/program/Java/ky/201311/28089.html