From: Kalpana T. <kal...@pe...> - 2009-03-23 12:53:04
|
<path id="cobertura.classpath"> <fileset dir="${cobertura.lib}"> <include name="cobertura.jar" /> <include name="**/*.jar" /> </fileset> </path> <target name="struts.test.instrument" depends="compile"> <echo>Instrumenting the application classes : </echo> <!-- Remove the coverage data file. --> <delete file="${cat.cobertura.dir}/coverage.ser"/> <delete dir="${cat.instrumented.dir}" /> <mkdir dir="${cat.instrumented.dir}" /> <!-- Instrument the application classes, writing the instrumented classes into ${build.instrumented.dir}. --> <cobertura-instrument todir="${cat.instrumented.dir}" datafile="${cat.cobertura.dir}/coverage.ser"> <classpath refid="cobertura.classpath" /> <classpath> <fileset dir="${lib.dir}"> <include name="**/*.jar"/> </fileset> </classpath> <!-- The following line causes instrument to ignore any source line containing a reference to log4j, for the purposes of coverage reporting. --> <ignore regex="org.apache.log4j.*" /> <fileset dir="${target.dir}"> <!-- Instrument all the application classes, but don't instrument the test classes. --> <include name="**/*.class" /> </fileset> </cobertura-instrument> </target> <target name="runJunitStrutsTestCases" depends="compile_junit_StrutsTestCases"> <mkdir dir="${base.dir}/Nightly_Build_Struts_Report" /> <mkdir dir="${base.dir}/Nightly_Build_Struts_Report/Html_reports" /> <junit printsummary="yes" fork="yes" forkmode="perTest" haltonfailure="yes" maxmemory="1024m"> <jvmarg value="-Xms128m"/> <jvmarg value="-Xmx1024m"/> <sysproperty key="net.sourceforge.cobertura.datafile" file="${cat.cobertura.dir}/coverage.ser" /> <sysproperty key="app.home" value="."/> <!-- Note the classpath order: instrumented classes are before the original (uninstrumented) classes. This is important. --> <classpath location="${cat.instrumented.dir}" /> <classpath location="${target.dir}" /> <classpath> <pathelement path="${cat.cobertura.dir}" /> <pathelement path="${cat.test.src.dir}" /> <!-- <pathelement path= "${target.dir}" /> --> <pathelement path= "${cat.test.classes.dir}" /> <fileset dir="${cat.test.lib.dir}"> <exclude name="catissuecore.jar" /> <include name="**/*.jar"/> </fileset> <fileset dir="${lib.dir}"> <include name="**/*.jar"/> </fileset> <fileset dir="${base.dir}/WEB-INF/"> <include name="**/*.properties"/> <include name="**/*.xml" /> <include name="**/*.tld" /> </fileset> </classpath> <classpath refid="cobertura.classpath" /> <formatter type="xml"/> <batchtest fork="yes" todir="${base.dir}/Nightly_Build_Struts_Report"> <fileset dir="${cat.test.src.dir}"> <include name="**/CaTissueSuiteTestSuite.java" /> </fileset> </batchtest> </junit> </target> <target name="struts.coverage.report"> <echo> Generating coverage reports :</echo> <mkdir dir="${base.dir}/Nightly_Build_Struts_Report/coveragereports/codeCoverageReportsXml"/> <mkdir dir="${base.dir}/Nightly_Build_Struts_Report/coveragereports/codeCoverageReportsHtml"/> <!-- Generate an XML file containing the coverage data using the "srcdir" attribute. --> <cobertura-report srcdir="${base.dir}/WEB-INF/src" destdir="${base.dir}/Nightly_Build_Struts_Report/coveragereports/codeCoverageReportsXml" datafile="${cat.cobertura.dir}/coverage.ser" format="xml" /> <!-- Generate a series of HTML files containing the coverage data in a user-readable form using nested source filesets. --> <cobertura-report destdir="${base.dir}/Nightly_Build_Struts_Report/coveragereports/codeCoverageReportsHtml"> <fileset dir="${base.dir}/WEB-INF/src"> <include name="**/*.java"/> </fileset> </cobertura-report> </target> |