Re: Code Coverage and Cactus

2005-08-19 Thread Quentin Pouplard


Hi David,

David Turley wrote: 
 I think I see the problem now, but I still need some help with fixing
 it.
 
 I also run some regular junit tests, so the coverage information for 
 those tests has been going into the jcoverage.ser file created by the 
 instrumenation phase, but the cactus task is trying to put its
 coverage  information into that file as well.  How do I create a
 second  jcoverage.ser file and put my cactus coverage information
 into it?  I  think that would solve my problem.

That's not an issue, after instrumentation you have one jcoverage.ser
(empty), you can copy it where you need it (in the classes directory of
your war and in the folder containing your instrumented classes used to
run junit test).

After that there is a merge task (that comes with jcoverage) that you
can use to create one jcoverage.ser file.

I just add to merge them to a temporary file then copy it to the working
dir (because the report task doesn't seem to allow custom jcoverage.ser
file location).

I hope this will help.

Regards,

Quentin

ps: by the way, jcoverage.ser file just looks like a serialized hashmap,
there is no magic here!

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



Re: Code Coverage and Cactus

2005-08-19 Thread David Turley

Thank you very much for your help.  I think I've got it working now!

Thanks again,
David Turley


Quentin Pouplard wrote:


Hi David,

David Turley wrote: 
 


I think I see the problem now, but I still need some help with fixing
it.

I also run some regular junit tests, so the coverage information for 
those tests has been going into the jcoverage.ser file created by the 
instrumenation phase, but the cactus task is trying to put its

coverage  information into that file as well.  How do I create a
second  jcoverage.ser file and put my cactus coverage information
into it?  I  think that would solve my problem.
   



That's not an issue, after instrumentation you have one jcoverage.ser
(empty), you can copy it where you need it (in the classes directory of
your war and in the folder containing your instrumented classes used to
run junit test).

After that there is a merge task (that comes with jcoverage) that you
can use to create one jcoverage.ser file.

I just add to merge them to a temporary file then copy it to the working
dir (because the report task doesn't seem to allow custom jcoverage.ser
file location).

I hope this will help.

Regards,

Quentin

ps: by the way, jcoverage.ser file just looks like a serialized hashmap,
there is no magic here!

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

 



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



Code Coverage and Cactus

2005-08-18 Thread David Turley

Hello everyone,

   I am trying to get code coverage to work with my cactus tests, but 
I'm having trouble.  I tried JCoverage (gpl version, of course) first 
and followed the instructions in another thread, but it seemed to be 
fairly sporadic.  It would work one run and fail the next with 
absolutely no change made.  I have no idea why.


   So then I decided to give Emma a try.  Unfortunately when it tries 
to dump the coverage information after the cactus tests, I get 
java.lang.ThreadDeath...  Apparently the thread is dying before emma can 
dump the data.  There's a new ant task for emma that allows you to dump 
whenever you want.  I was hoping to use that before cactus shut tomcat5 
down again, but the cactus task doesn't allow me to nest the emma 
task...  Is there a way to execute that emma task before cactus shuts 
tomcat down?


   Has anyone had any success with jcoverage or emma with cactus?

Thanks,
David

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



Re: Code Coverage and Cactus

2005-08-18 Thread Quentin Pouplard


David Turley wrote: 
 Has anyone had any success with jcoverage or emma with cactus?

We successfuly run jcoverage with cactus, basically our ant script does
the following: - instrument the classes - make a war with instrumented
classes - launch cactus test with this war - collect all the
jcoverage.ser file - merge them and create the report

It works for us. We use tomcat as server and nothing special.

Maybe if you could give us more info, I would be able (or anyone else)
to help more.

Best regards,

Quentin Pouplard

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



Re: Code Coverage and Cactus

2005-08-18 Thread David Turley

Here are the parts of my build.xml I think are relevant:

   target name=instrument description=Add jcoverage instrumentation
   instrument todir=${build.instrumented-classes.dir}
 ignore regex=org.apache.log4j.*/
 fileset dir=${build.classes.dir}
   include name=**/*.class/
 /fileset
   /instrument
   /target
target name=make-war
   war destfile=${dist.home}/pre.war webxml=${local.web.xml}
 fileset dir=${web.home} 
excludes=WEB-INF/,SESSIONS.ser,**/*.iml /
 !-- Need to exclude the WEB-INF directory to keep from 
getting duplicate versions of files in the WAR--

 lib dir=${lib.dir}/

 webinf dir=${build.dir} excludes=web.xml,classes/,lib/, 
coverage/, instrumented-classes/, reports/, test-classes/ /
 classes dir=${build.instrumented-classes.dir} 
includes=**/*.class,**/*.properties /

   /war
   cactifywar srcfile=${dist.home}/pre.war 
destfile=${dist.home}/${app.name}.war
   classes dir=${build.test-classes.dir} 
includes=**/*CactusTest.class/

 /cactifywar
   /target

   target name=cactus
   cactus warfile=${dist.home}/${app.name}.war fork=yes
 failureproperty=tests.failed
   classpath location=${build.instrumented-classes.dir}/
   classpath location=${build.classes.dir}/
   classpath location=${build.test-classes.dir}/
   classpath
   path refid=cactus.classpath/
   fileset dir=${lib.dir}
   !-- needed because some of the tests use StrutsTestCase--
   include name=struts.jar/
   /fileset
   /classpath
   
   !--cactusproperty server=false

   propertiesFile=logging.properties/
   cactusproperty server=true
   propertiesFile=logging.properties/--
   containerset timeout=18
   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=${build.test-classes.dir} 
includes=**/*CactusTest.class/

   /batchtest
 /cactus
   /target


Here's the process, and it's virtually identical to yours.  I initialize 
some directories, compile my classes, instrument them, make my war with 
the instrumented classes, launch cactus with that war.  That's when I 
check the jcoverage.ser file in an editor.  Most of the time the file 
exists but is empty, but occasionally it stuff in it and everything is 
fine and dandy...  It's when it's empty that I get an EOFException in 
the reports phase...  I have run the exact same thing twice in a row and 
the first time everything would work and the next time it doesn't.  Do 
you see anything in there that would cause this kind of behavior?


Quentin Pouplard wrote:

David Turley wrote: 
 


   Has anyone had any success with jcoverage or emma with cactus
   



We successfuly run jcoverage with cactus, basically our ant script does
the following: - instrument the classes - make a war with instrumented
classes - launch cactus test with this war - collect all the
jcoverage.ser file - merge them and create the report

It works for us. We use tomcat as server and nothing special.

Maybe if you could give us more info, I would be able (or anyone else)
to help more.

Best regards,

Quentin Pouplard

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

 



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



Re: Code Coverage and Cactus

2005-08-18 Thread Quentin Pouplard


Hi David,

David Turley wrote: 
 Oh, I noticed you said that you merge all the jcoverage.ser files... 
 I  only get one jcoverage.ser file.  How do you get more than one and
 where  are they located?

I don't have the detail right now, I will look at it tomorrow, but the
first thing I wonder is when exactly do you include the generated
jcoverage.ser file in your war?

I take some time to realize how jcoverage works but the main idea is
that instrumenting does the following task: - instrument the code to add
code to feed jcoverage.ser file - generate an empty jcoverage.ser file
containing counter initialized to zero.

I have more than one jcoverage.ser file because I run both cactus test
and classic unit test, so I have the jcoverage on the tomcat side and
the one on the client side, I merge them to get a single report showing
me the global coverage for my tests.

Hope it will help,

Quentin Pouplard

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



Re: Code Coverage and Cactus

2005-08-18 Thread David Turley

I think I see the problem now, but I still need some help with fixing it.

I also run some regular junit tests, so the coverage information for 
those tests has been going into the jcoverage.ser file created by the 
instrumenation phase, but the cactus task is trying to put its coverage 
information into that file as well.  How do I create a second 
jcoverage.ser file and put my cactus coverage information into it?  I 
think that would solve my problem.


Thanks,
David Turley

Quentin Pouplard wrote:


Hi David,

David Turley wrote: 
 

Oh, I noticed you said that you merge all the jcoverage.ser files... 
I  only get one jcoverage.ser file.  How do you get more than one and

where  are they located?
   



I don't have the detail right now, I will look at it tomorrow, but the
first thing I wonder is when exactly do you include the generated
jcoverage.ser file in your war?

I take some time to realize how jcoverage works but the main idea is
that instrumenting does the following task: - instrument the code to add
code to feed jcoverage.ser file - generate an empty jcoverage.ser file
containing counter initialized to zero.

I have more than one jcoverage.ser file because I run both cactus test
and classic unit test, so I have the jcoverage on the tomcat side and
the one on the client side, I merge them to get a single report showing
me the global coverage for my tests.

Hope it will help,

Quentin Pouplard

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

 



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