• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Measuring code coverage with Cobertura on the serverside

 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
(moved over from another thread

Originally posted by Rajkumar Chandrasekaran:
I have a situation here where i must find out the code coverage when my application is running. In more detailed terms, i compile the classes and instrument them and if i build a war or a ear file with the instrumented classes and deploy it on the server like tomcat or jboss and i hit the url the classes work fine, but where will the .ser (trying to use jcoverage). files will be created so that i can generate reports.


The default is to write the .ser file to "cobertura.ser" in the working directory. What that means for your Tomcat or JBoss installation, I don't know.

You can override the default at instrumentation time by giving the <cobertura-instrument/> task the "datafile" attribute, pointing to where you want the .ser file to be written.
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I changed the build file to something like this <cobertura-instrument todir="${instrumented.dir}" datafile="c:\cobertura.ser">
and ran the sample script which came with the download. I am getting a error as follows
[cobertura-instrument] Cobertura: Error reading file c:\cobertura.ser: null
[cobertura-instrument] Instrumenting 1 file to D:\cobertura-1.8\examples\basic\i

please let me know if i am missing something here.

Thanks for the help

With Regards
Rajkumar
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, you could try "C:/cobertura.ser" instead of "C:\cobertura.ser". If that doesn't help, you might want to email to the cobertura-devel mailing list as well.

Also, are you running Cobertura under the D: drive? Have you tried "D:/cobertura.ser" instead of "C:/cobertura.ser"?
 
Rajkumar Chandrasekaran
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the information, Finally got it to work,

Using corbertura -1.8 and tomcat the files got placed from where the server's executable was present. Was able to generate the .ser file and the reports as well.

Once again thanks for the information

Rajkumar
 
reply
    Bookmark Topic Watch Topic
  • New Topic