I took Bret Kumler's suggestion and got Cobertura. I'm having a bit of a problem with it though. I don't think cobertura is dumping the coverage information soon enough after running the cactus tests. The tests run and then Tomcat starts shutting down and then I get the following error:

[cactus] INFO: Illegal access: this web application instance has been stopped already (the eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact)

When I get that error, my cobertura.ser file is suddenly empty and the report fails with an EOFException.

Anyone have any thoughts on how to fix this? Apparently the coverage information isn't dumped until the JVM exits. Is there a way to have the tests run on a different fork than the container control part of the task?

In case anyone cares to see it, here's part of my build.xml:

   <target name="cactus">
       <cactus warfile="${dist.home}/${app.name}.war" fork="yes"
             failureproperty="test.failed">
           <classpath>
               <path refid="cactus.classpath"/>
                      <fileset dir="${lib.dir}">
                       <include name="struts.jar"/>
                   </fileset>
                </classpath>
           <classpath location="${build.instrumented-classes.dir}"/>
           <classpath location="${build.classes.dir}"/>
           <classpath location="${cactus.test.classes.dir}"/>
           <sysproperty key="net.sourceforge.cobertura.datafile"
file="${cactus.test.classes.dir}/cobertura.ser" /> <!--<cactusproperty server="false"
                    propertiesFile="logging.properties"/>
               <cactusproperty server="true"
                      propertiesFile="logging.properties"/>-->
           <containerset timeout="180000">
               <!-- cactus automatically uses the system temp directory
                    for a temporary tomcat installation.  The directory
                    is as follows: env.TMP/cactus/tomcat5 .  To specify
a different temp directory, use the tmpdir attribute -->
                 <tomcat5x
                     dir="${env.TOMCAT_HOME}" port="8081"
                      serverxml="${basedir}/server.xml"
                  />
           </containerset>
           <formatter type="brief" usefile="false"/>
           <formatter type="xml"/>
           <batchtest todir="${build.reports.dir}">
<fileset dir="${cactus.test.classes.dir}" includes="**/*CactusTest.class"/>
           </batchtest>
       </cactus>
   </target>


--David Turley

P.S. To Bret Kumler, I didn't have any problems with Struts and StrutsTestCase when I switched to Cobertura. I could post more of my build.xml if you'd like, but I don't know that it would be much help...

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to