From: Vanitha S. <van...@gm...> - 2007-05-23 19:43:04
|
Hi, I have followed the following steps to do code coverage through cobertura. But i got 0% coveragefrom the report. If anyone answer why it is not updated? 1. Install your application. 2. Write an ant script with an "instrumentation" target. It will look similar to the example on the cobertura web site: <delete file="cobertura.ser" /> <cobertura-instrument todir="${instrumented.dir}"> <includeClasses regex=".*" /> <excludeClasses regex=".*\.Test.*" /> <instrumentationClasspath> <path refid="test.classpath" /> <pathelement location="${test.build}" /> </instrumentationClasspath> </cobertura-instrument> Make sure the jars/ears/wars are included in the "instrumentationClasspath". The packages you are interested in seeing in the coverage report should be included in the <includeClasses> regular expression. 3. After running the "instrumentation" target, move the cobertura.ser file that is generated to the working directory of your application. 4. Start your application. This is pretty much like normal except you have to make sure cobertura.jar is on the classpath. 5. Do whatever manual testing you want to do. 6. Shut down the application. The process must shut down completely. 7. Then run a "report" target in your ant script. Make sure you use the cobertura.ser file that is in the working directory of your application. The report target will look similar to what is on the cobertura site: <cobertura-report format="html" destdir="${coveragereport.dir}" > <fileset dir="${src.dir}"> <include name="**/*.java" /> <exclude name="**/*Stub.java" /> </fileset> <fileset dir="${guisrc.dir}"> <include name="**/*.java" /> <exclude name="**/*RB.java" /> </fileset> </cobertura-report> Is that instrumented classes need to be used or placed into classpath of application. Is any steps need to be performed. Please ellaborate the steps need to be done as part cobertura setup in application procedure. Explain what is the thing exist in cobertura.ser and is that changed during application testing? What is the roll of instrumented classes? I am in little bit confusion about this. Please clarify at the earliest. -- Thanks, Vanitha. S |