From: Grzegorz L. <ha...@gm...> - 2005-08-23 21:55:13
|
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. >=20 > I'm using tomcat now. >=20 > With weblogic, i didn't need to put the instrumented classes in the > war/ear file. >=20 > I put the instrumented classes in the server's classpath and it worked fi= ne. >=20 > I'll try to put them in the war and see what happens. >=20 > 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 performing > > 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 cla= sses? > > > > > > On 8/23/05, Grzegorz Lukasik <ha...@gm...> wrote: > > > > One more hit, maybe in created war you do not have instrumented cla= sses? > > > > > > > > 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 t= he > > > > > > 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 pro= cess? > > > > > > > > > > > > > > I watched it after instrumentation, its 691k. > > > > > > > > > > > > > > After my tests run and the reports are executed, it's still t= he same 691k. > > > > > > > > > > > > > > On 8/23/05, yamaduc <ya...@gm...> wrote: > > > > > > > > Well, I tried passing it in as a runtime paramter to the jv= m. > > > > > > > > > > > > > > > > Then the report task complained, couldn't find cobertura.se= r. > > > > > > > > > > > > > > > > So, I added datafile to the ant task and the error message = 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 cover= age 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 generat= ed. > > > > > > > > The HTML report is ${test.results}/= coverage/index.html > > > > > > > > </echo> > > > > > > > > > > > > > > > > </target> > > > > > > > > > > > > > > > > On 8/23/05, Grzegorz Lukasik <ha...@gm...> wrote: > > > > > > > > > Hey, > > > > > > > > > > > > > > > > > > You probably do not set property net.sourceforge.cobertur= a.datafile > > > > > > > > > when running tests (I do not know how to do it inside cac= tus task). Do > > > > > > > > > you get additional cobertura.ser in directory where tests= 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" descrip= tion=3D"Add Cobertura > > > > > > > > > > instrumentation"> > > > > > > > > > > <!-- instrument the application classes= , writing the instrumented > > > > > > > > > > classes into ${instrumented.classes}. --> > > > > > > > > > > > > > > > > > > > > <cobertura-instrument datafile=3D"${tes= t.dir}/cobertura.ser" > > > > > > > > > > todir=3D"${instrumented.classes}"> > > > > > > > > > > <!-- Note that the following li= ne causes instrument to ignore any > > > > > > > > > > source line containing a r= eference to log4j, for the purposes > > > > > > > > > > of coverage reporting.= --> > > > > > > > > > > <ignore regex=3D"org.apache.log= 4j.*"/> > > > > > > > > > > > > > > > > > > > > <fileset dir=3D"${classes.dir}"= > > > > > > > > > > > <!-- instrument all the= application classes, but don't instrument > > > > > > > > > > the test classes. --> > > > > > > > > > > <include name=3D"**/*.c= lass"/> > > > > > > > > > > <exclude name=3D"**/*Te= st.class"/> > > > > > > > > > > </fileset> > > > > > > > > > > </cobertura-instrument> > > > > > > > > > > > > > > > > > > > > </target> > > > > > > > > > > > > > > > > > > > > <target name=3D"test" depends=3D"prepare.test.package" = description=3D"Run > > > > > > > > > > the tests on the defined container"> > > > > > > > > > > <!-- Run the tests --> > > > > > > > > > > <mkdir dir=3D"${test.results}/tomcat4x"= /> > > > > > > > > > > <cactus warfile=3D"${test-war.dir}/${ap= p.name}-${app.version}.war" > > > > > > > > > > fork=3D"yes" failureproperty=3D"tests.failed" haltonerr= or=3D"true"> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > <!-- Configure the cactus task = for logging --> > > > > > > > > > > <cactusproperty server=3D"false= " > > > > > > > > > > propertiesFile=3D"${met= a.dir}/${configtype}/test/logging_client.properties"/> > > > > > > > > > > <cactusproperty server=3D"true" > > > > > > > > > > propertiesFile=3D"${met= a.dir}/${configtype}/test/logging_server.properties"/> > > > > > > > > > > > > > > > > > > > > <!-- Additional jars that will = be added to the classpath used to start the > > > > > > > > > > container (in addition= to the container jars themseleves which are > > > > > > > > > > automatically added by= the <cactus> task --> > > > > > > > > > > <containerclasspath> > > > > > > > > > > <pathelement path=3D"${= test-props.dir}"/> > > > > > > > > > > </containerclasspath> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > <classpath> > > > > > > > > > > <pathelement path=3D"${= instrumented.classes}"/> > > > > > > > > > > <pathelement path=3D"${= classes.dir}"/> > > > > > > > > > > <pathelement location= =3D"${test-lib.dir}/my-tests.jar"/> > > > > > > > > > > <path refid=3D"project.= classpath"/> > > > > > > > > > > </classpath> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > <containerset> > > > > > > > > > > <tomcat4x if=3D"tomcat-= dist.dir" > > > > > > > > > > dir= =3D"${tomcat-dist.dir}" port=3D"${test.port}" > > > > > > > > > > outpu= t=3D"${test.results}/tomcat4x.out" > > > > > > > > > > todir= =3D"${test.results}/tomcat4x" > > > > > > > > > > tmpdi= r=3D"${test.temp.dir}" > > > > > > > > > > jvmAr= gs=3D"-DGG_HOME=3DC:/test"/> > > > > > > > > > > </containerset> > > > > > > > > > > > > > > > > > > > > <formatter type=3D"brief" usefi= le=3D"false"/> > > > > > > > > > > <formatter type=3D"xml"/> > > > > > > > > > > > > > > > > > > > > <batchtest> > > > > > > > > > > <fileset dir=3D"${tests= rc.dir}"> > > > > > > > > > > <include name= =3D"**/Test*.java"/> > > > > > > > > > > <exclude name= =3D"**/Test*All.java"/> > > > > > > > > > > </fileset> > > > > > > > > > > </batchtest> > > > > > > > > > > > > > > > > > > > > </cactus> > > > > > > > > > > <!-- Generate the JUnit reports --> > > > > > > > > > > > > > > > > > > > > <junitreport todir=3D"${test.results}/t= omcat4x"> > > > > > > > > > > <fileset dir=3D"${test.results}= /tomcat4x" > > > > > > > > > > includes=3D"TE= ST-*.xml"/> > > > > > > > > > > <report todir=3D"${test.results= }/tomcat4x" > > > > > > > > > > format=3D"frame= s"/> > > > > > > > > > > </junitreport> > > > > > > > > > > > > > > > > > > > > <fail if=3D"tests.failed">At least one = test failed!</fail> > > > > > > > > > > > > > > > > > > > > </target> > > > > > > > > > > > > > > > > > > > > <target name=3D"coverage" description=3D"HTML coverage = 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> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > I'm getting 0% coverage for all tests. > > > > > > > > > > > > > > > > > > > > Is there a way to see if the classes have been instrume= nted? > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------- > > > > > > > > > > SF.Net email is Sponsored by the Better Software Confer= ence & EXPO > > > > > > > > > > September 19-22, 2005 * San Francisco, CA * Development= Lifecycle Practices > > > > > > > > > > Agile & Plan-Driven Development * Managing Projects & T= eams * Testing & QA > > > > > > > > > > Security * Process Improvement & Measurement * http://w= ww.sqe.com/bsce5sf > > > > > > > > > > _______________________________________________ > > > > > > > > > > Cobertura-devel mailing list > > > > > > > > > > Cob...@li... > > > > > > > > > > https://lists.sourceforge.net/lists/listinfo/cobertura-= devel > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |