java - Cobertura shows 0% coverage for instrumented WAR in Tomcat -


we bunch of automated testing against deployed java web application (in addition unit testing) , track code coverage of these tests. app written in java , runs on tomcat. use cobertura track coverage our unit tests i’d stick cobertura. i’ve instrumented our war , able generate reports coberura.ser file show 0% coverage.

here steps i’m following:

  1. build jar , war in normal process (no instrumenting). our application classes packaged jar file placed in lib director of war deploy.
  2. unpack both jar , war
  3. rebuild again time instrument classes.
  4. copy instrumented classes in unpacked jar directory. i’m doing because instrumenting not seem output class files things not have runnable code (like interfaces).
  5. build jar unpacked jar directory
  6. add new instrumented jar , cobertura.jar lib directory of unpacked war directory , build war that.
  7. add new instrumented war , coberturaflush.war tomcat webapps directory
  8. add cobertura.ser (that generated during instrumentation) tomcat bin directory
  9. start tomcat
  10. do stuff in app
  11. hit /coberturaflush/flushcobertura in browser.
  12. stop tomcat
  13. use cobertura-report.bat generate report cobertura.ser file

here's i've tried far:

  • i confirmed class files in jar have references cobertura i’m confident instrumented.
  • i’m using coberturaflush.war because i’m getting bunch of noclassdeffound errors when stop app doesn’t shutdown hook working correctly. seems common issue , coberturaflush seems reasonable workaround.
  • i’m confident cobertura using correct .ser file. when tomcat starts see file go down 0kb , cobertura.ser.lock file created , in goes original size , lock file deleted. see same thing happen when call flushcobertura when shut down tomcat.
  • i’ve tried generating reports .ser file after call flush before stop tomcat , did not work either.

am missing something? idea why cobertura says 0% coverage?

thanks in advance.

i think may in "jar hell". having same problem, , able around by:

  1. do not include cobertura.jar file in webapp environment
  2. do copy cobertura.jar file tomcat common library directory

coberturaflush looking lib @ tomcat level; having instance inside web app, counters webapp separate overall tomcat counters.

another alternative, not best works, have webapp call saveglobalprojectdata method outlined in cobertura faq. both methods worked me, since didn't want add special code app, chose first.


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

http - Safari render HTML as received -