From: Grzegorz L. <ha...@gm...> - 2005-08-23 22:38:56
|
Try to run ant with -v option, there should be stack trace with more detail= . Did you put only instrumented classes into war? If Cobertura does not instrument class for some reason (e.g. for interface) it does not put uninstrumented file among instrumented. Maybe some interface is missing? (You should copy all remaining files to the war). Or maybe Cobertura library is not in Tomcat libs? I am just guessing. Grzegorz PS. I am going sleep, so I won't be able to answer today. On 8/24/05, yamaduc <ya...@gm...> wrote: > Here's what happens when i put the instrumented classes in the war file. >=20 > [cactus] Testcase: > testExceptionBean(org.apache.cactus.ServletTestCase): Caused an > ERROR > [cactus] Error while initializing ActionServlet: Parsing error > processing resource path /WEB-INF/struts-config.xml > [cactus] junit.framework.AssertionFailedError: Error while > initializing ActionServlet: Parsing error processing resource path > /WEB-INF/struts-config.xml >=20 > I tried it without the instrumented classes in the war file and this > message does not appear. >=20 >=20 > On 8/23/05, Grzegorz Lukasik <ha...@gm...> wrote: > > If you put insturmented classes in serverclasses dir for Weblogic, > > then they were treaten as part of web application. > > > > You can try (at least for test) to instrument war - it should be > > possible from Cobertura 1.5. Be aware that you will need cobertura.jar > > (and dependend) in some tomcat lib subdirectory (or you can pack it > > into war). > > > > Grzegorz > > > > On 8/23/05, yamaduc <ya...@gm...> wrote: > > > I had this working before with weblogic just fine. > > > > > > I'm using tomcat now. > > > > > > With weblogic, i didn't need to put the instrumented classes in the > > > war/ear file. > > > > > > I put the instrumented classes in the server's classpath and it worke= d fine. > > > > > > I'll try to put them in the war and see what happens. > > > > > > On 8/23/05, Grzegorz Lukasik <ha...@gm...> wrote: > > > > Correct me if I'm wrong, cactus task work this way: > > > > > > > > - deploy war inside application container > > > > - run tests on deployed application by cactus > > > > > > > > So if I get it right, classes packed into war are used when perform= ing > > > > tests. When you specifiy classpath inside cactus task, it specifies > > > > classpath for test classes. So you need insturmented classes packed > > > > into war, so that they are run during tests. > > > > > > > > Grzegorz > > > > > > > > On 8/23/05, yamaduc <ya...@gm...> wrote: > > > > > so i should have the instrumented classes instead of the standard= classes? > > > > > > > > > > On 8/23/05, Grzegorz Lukasik <ha...@gm...> wrote: > > > > > > One more hit, maybe in created war you do not have instrumented= classes? > > > > > > > > > > > > On 8/23/05, yamaduc <ya...@gm...> wrote: > > > > > > > The date never changes. > > > > > > > > > > > > > > > > > > > > > On 8/23/05, Grzegorz Lukasik <ha...@gm...> wrote: > > > > > > > > Yes, it should be updated when tests are run but size will = be the > > > > > > > > same. Check file change date. > > > > > > > > > > > > > > > > Reports does not update cobertura.ser. > > > > > > > > > > > > > > > > Grzegorz > > > > > > > > > > > > > > > > On 8/23/05, yamaduc <ya...@gm...> wrote: > > > > > > > > > Is the cobertura.ser supposed to update during the report= process? > > > > > > > > > > > > > > > > > > I watched it after instrumentation, its 691k. > > > > > > > > > > > > > > > > > > After my tests run and the reports are executed, it's sti= ll the same 691k. > > > > > > > > > > > > > > > > > > On 8/23/05, yamaduc <ya...@gm...> wrote: > > > > > > > > > > Well, I tried passing it in as a runtime paramter to th= e jvm. > > > > > > > > > > > > > > > > > > > > Then the report task complained, couldn't find cobertur= a.ser. > > > > > > > > > > > > > > > > > > > > So, I added datafile to the ant task and the error mess= age went away, > > > > > > > > > > see ant target below. > > > > > > > > > > > > > > > > > > > > I only have one .ser file. > > > > > > > > > > <cobertura-instrument datafile=3D"${test.dir}/cobertura= .ser" > > > > > > > > > > todir=3D"${instrumented.classes}"> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > <target name=3D"coverage" description=3D"HTML c= overage reports can be > > > > > > > > > > found in build/coverage"> > > > > > > > > > > > > > > > > > > > > <mkdir dir=3D"${test.results}/coverage"= /> > > > > > > > > > > <cobertura-report srcdir=3D"${src.dir}" > > > > > > > > > > destdir=3D"${test.results}/coverage" > > > > > > > > > > datafile=3D"${test.dir}/cobertura.ser"/> > > > > > > > > > > > > > > > > > > > > <echo> > > > > > > > > > > Cobertura reports have been gen= erated. > > > > > > > > > > The HTML report is ${test.resul= ts}/coverage/index.html > > > > > > > > > > </echo> > > > > > > > > > > > > > > > > > > > > </target> > > > > > > > > > > > > > > > > > > > > On 8/23/05, Grzegorz Lukasik <ha...@gm...> wrote: > > > > > > > > > > > Hey, > > > > > > > > > > > > > > > > > > > > > > You probably do not set property net.sourceforge.cobe= rtura.datafile > > > > > > > > > > > when running tests (I do not know how to do it inside= cactus task). Do > > > > > > > > > > > you get additional cobertura.ser in directory where t= ests are run? > > > > > > > > > > > > > > > > > > > > > > Grzegorz > > > > > > > > > > > > > > > > > > > > > > On 8/23/05, yamaduc <ya...@gm...> wrote: > > > > > > > > > > > > Hi all, > > > > > > > > > > > > > > > > > > > > > > > > I have the following build script. > > > > > > > > > > > > > > > > > > > > > > > > <target name=3D"instrument" depends=3D"compile" des= cription=3D"Add Cobertura > > > > > > > > > > > > instrumentation"> > > > > > > > > > > > > <!-- instrument the application cla= sses, writing the instrumented > > > > > > > > > > > > classes into ${instrumented.classes}. --> > > > > > > > > > > > > > > > > > > > > > > > > <cobertura-instrument datafile=3D"$= {test.dir}/cobertura.ser" > > > > > > > > > > > > todir=3D"${instrumented.classes}"> > > > > > > > > > > > > <!-- Note that the followin= g line causes instrument to ignore any > > > > > > > > > > > > source line containing= a reference to log4j, for the purposes > > > > > > > > > > > > of coverage report= ing. --> > > > > > > > > > > > > <ignore regex=3D"org.apache= .log4j.*"/> > > > > > > > > > > > > > > > > > > > > > > > > <fileset dir=3D"${classes.d= ir}"> > > > > > > > > > > > > <!-- instrument all= the application classes, but don't instrument > > > > > > > > > > > > the test classes. --> > > > > > > > > > > > > <include name=3D"**= /*.class"/> > > > > > > > > > > > > <exclude name=3D"**= /*Test.class"/> > > > > > > > > > > > > </fileset> > > > > > > > > > > > > </cobertura-instrument> > > > > > > > > > > > > > > > > > > > > > > > > </target> > > > > > > > > > > > > > > > > > > > > > > > > <target name=3D"test" depends=3D"prepare.test.packa= ge" description=3D"Run > > > > > > > > > > > > the tests on the defined container"> > > > > > > > > > > > > <!-- Run the tests --> > > > > > > > > > > > > <mkdir dir=3D"${test.results}/tomca= t4x"/> > > > > > > > > > > > > <cactus warfile=3D"${test-war.dir}/= ${app.name}-${app.version}.war" > > > > > > > > > > > > fork=3D"yes" failureproperty=3D"tests.failed" halto= nerror=3D"true"> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > <!-- Configure the cactus t= ask for logging --> > > > > > > > > > > > > <cactusproperty server=3D"f= alse" > > > > > > > > > > > > propertiesFile=3D"$= {meta.dir}/${configtype}/test/logging_client.properties"/> > > > > > > > > > > > > <cactusproperty server=3D"t= rue" > > > > > > > > > > > > propertiesFile=3D"$= {meta.dir}/${configtype}/test/logging_server.properties"/> > > > > > > > > > > > > > > > > > > > > > > > > <!-- Additional jars that w= ill be added to the classpath used to start the > > > > > > > > > > > > container (in addi= tion to the container jars themseleves which are > > > > > > > > > > > > automatically adde= d by the <cactus> task --> > > > > > > > > > > > > <containerclasspath> > > > > > > > > > > > > <pathelement path= =3D"${test-props.dir}"/> > > > > > > > > > > > > </containerclasspath> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > <classpath> > > > > > > > > > > > > <pathelement path= =3D"${instrumented.classes}"/> > > > > > > > > > > > > <pathelement path= =3D"${classes.dir}"/> > > > > > > > > > > > > <pathelement locati= on=3D"${test-lib.dir}/my-tests.jar"/> > > > > > > > > > > > > <path refid=3D"proj= ect.classpath"/> > > > > > > > > > > > > </classpath> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > <containerset> > > > > > > > > > > > > <tomcat4x if=3D"tom= cat-dist.dir" > > > > > > > > > > > > d= ir=3D"${tomcat-dist.dir}" port=3D"${test.port}" > > > > > > > > > > > > o= utput=3D"${test.results}/tomcat4x.out" > > > > > > > > > > > > t= odir=3D"${test.results}/tomcat4x" > > > > > > > > > > > > t= mpdir=3D"${test.temp.dir}" > > > > > > > > > > > > j= vmArgs=3D"-DGG_HOME=3DC:/test"/> > > > > > > > > > > > > </containerset> > > > > > > > > > > > > > > > > > > > > > > > > <formatter type=3D"brief" u= sefile=3D"false"/> > > > > > > > > > > > > <formatter type=3D"xml"/> > > > > > > > > > > > > > > > > > > > > > > > > <batchtest> > > > > > > > > > > > > <fileset dir=3D"${t= estsrc.dir}"> > > > > > > > > > > > > <include na= me=3D"**/Test*.java"/> > > > > > > > > > > > > <exclude na= me=3D"**/Test*All.java"/> > > > > > > > > > > > > </fileset> > > > > > > > > > > > > </batchtest> > > > > > > > > > > > > > > > > > > > > > > > > </cactus> > > > > > > > > > > > > <!-- Generate the JUnit reports --> > > > > > > > > > > > > > > > > > > > > > > > > <junitreport todir=3D"${test.result= s}/tomcat4x"> > > > > > > > > > > > > <fileset dir=3D"${test.resu= lts}/tomcat4x" > > > > > > > > > > > > includes= =3D"TEST-*.xml"/> > > > > > > > > > > > > <report todir=3D"${test.res= ults}/tomcat4x" > > > > > > > > > > > > format=3D"f= rames"/> > > > > > > > > > > > > </junitreport> > > > > > > > > > > > > > > > > > > > > > > > > <fail if=3D"tests.failed">At least = one test failed!</fail> > > > > > > > > > > > > > > > > > > > > > > > > </target> > > > > > > > > > > > > > > > > > > > > > > > > <target name=3D"coverage" description=3D"HTML cover= age reports can be > > > > > > > > > > > > found in build/coverage"> > > > > > > > > > > > > > > > > > > > > > > > > <mkdir dir=3D"${test.results}/cover= age"/> > > > > > > > > > > > > <cobertura-report srcdir=3D"${src.d= ir}" > > > > > > > > > > > > destdir=3D"${test.results}/coverage" > > > > > > > > > > > > datafile=3D"${test.dir}/cobertura.ser"/> > > > > > > > > > > > > > > > > > > > > > > > > <echo> > > > > > > > > > > > > Cobertura reports have been= generated. > > > > > > > > > > > > The HTML report is ${test.r= esults}/coverage/index.html > > > > > > > > > > > > </echo> > > > > > > > > > > > > > > > > > > > > > > > > </target> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > I'm getting 0% coverage for all tests. > > > > > > > > > > > > > > > > > > > > > > > > Is there a way to see if the classes have been inst= rumented? > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ---------------------------------------------------= ---- > > > > > > > > > > > > SF.Net email is Sponsored by the Better Software Co= nference & EXPO > > > > > > > > > > > > September 19-22, 2005 * San Francisco, CA * Develop= ment Lifecycle Practices > > > > > > > > > > > > Agile & Plan-Driven Development * Managing Projects= & Teams * Testing & QA > > > > > > > > > > > > Security * Process Improvement & Measurement * http= ://www.sqe.com/bsce5sf > > > > > > > > > > > > _______________________________________________ > > > > > > > > > > > > Cobertura-devel mailing list > > > > > > > > > > > > Cob...@li... > > > > > > > > > > > > https://lists.sourceforge.net/lists/listinfo/cobert= ura-devel > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |