From: Beebe, M. J <Be...@ba...> - 2012-05-11 18:09:37
|
You were right. I cannot believe it was that easy. Thanks, Mary From: John W. Lewis [mailto:Joh...@sa...] Sent: Wednesday, May 09, 2012 9:31 PM To: Beebe, Mary J; cob...@li... Subject: RE: 0% Line Coverage and Branch Coverage Change this: <classpath location="cobertura-instrumented.dir" /> To: <classpath location="${cobertura-instrumented.dir}" /> By the way, if you use <sysproperty>, it has to be inside the <junit>, but I don't think you need that. John From: Beebe, Mary J [mailto:Be...@ba...] Sent: Wednesday, May 09, 2012 5:55 PM To: cob...@li... Subject: [Cobertura-devel] FW: 0% Line Coverage and Branch Coverage Sorry if I sent this twice. I wanted to confirm that you received it. I just downloaded cobertura and tried to add it to my ant script that runs my tests. I followed: http://cobertura.sourceforge.net/anttaskreference.html My Coverage Report has # Classes and Complexity probably correct but Line Coverage and Branch Coverage is showing 0% for all my classes. Early in my build.xml, I make the classpath. <path id="cobertura.classpath"> <fileset dir="${cobertura.dir}"> <include name="cobertura.jar" /> <include name="lib/**/*.jar" /> </fileset> </path> I add this line, but I am not sure about this line. <taskdef classpathref="cobertura.classpath" resource="tasks.properties" /> I do a clean and init that deletes the instrumented, report directory, and cobertura.ser. Init recreates the directories. I compile and build the jars. In a pretest target I run <cobertura-instrument todir="${cobertura-instrumented.dir}"> <fileset dir="${build-api}"> <include name="**/*.class" /> </fileset> <fileset dir="${build-client}"> <include name="**/*.class" /> </fileset> <fileset dir="${build-server}"> <include name="**/*.class" /> </fileset> </cobertura-instrument> I compile all my unit tests. Then I run the tests. <target name="test-api" depends="compile-test-api" description="Tests the api unit tests."> <junit fork="yes" failureProperty="api.test.failure"> <classpath location="cobertura-instrumented.dir" /> <classpath refid="classpath-api-test" /> <classpath refid="cobertura.classpath" /> <formatter type="brief" usefile="false" /> <batchtest> <fileset dir="${test-build-api}" includes="**/*.class"/> </batchtest> </junit> <fail message="test failed" if="api.test.failure" /> </target> Other classpaths I am using. <path id="classpath-api-test"> <pathelement location="api/lib/junit_4/junit-4.5.jar" /> <pathelement location="${test-build-api}" /> <!-- pathelement location="${build-api}"/ --> <path refid="classpath-to-api" /> </path> <path id="classpath-to-api"> <fileset dir="${dist-api}"> <include name="${jar-api}"/> </fileset> </path> I tried to add <sysproperty key="net.sourceforge.cobertura.datafile" file="cobertura.ser" /> but got an error that said "failed to create task or type sysproperty Cause: The name is undefined. Thank you for any help you can give. We do not have great code coverage but it should not be 0% all over. Thank you, Mary |