Kobertura on Tomkat

I am trying to apply code coverage using Cobertura. The application is deployed to Tomcat 5, but when I process the .class files, the application stops working.

These are my steps:

  • Compile the application (this launch in tomcat)
  • Class file tool.

    D:\test\cobertura-1.9.4.1\cobertura-instrument.bat --destination D:\test\instrument D:\src\path_to_app\main\target\webapp 
  • Overwrite class files D:\src\path_to_app\main\target\webapp with instrumental class files in D:\test\instrument .

  • Deploy the application to Tomcat via Catalina conf or war file. (The application does not work)

Does anyone have the right steps to deploy the application correctly on Tomcat with classes organized by Cobertura?

Link: http://cobertura.sourceforge.net/faq.html

I am using cobertura-1.9.4.1

+7
source share
2 answers

The correct steps were:

  • Compile the application
  • Class file tool. D:\test\cobertura-1.9.4.1\cobertura-instrument.bat --destination D:\test\instrument D:\src\path_to_app\main\target\webapp (created by cobertura.ser)

  • Overwrite class files D:\src\path_to_app\main\target\webapp with instrumental class files in D:\test\instrument .

  • Copy the cobertura.jar file to WEB-INF / lib
  • Deploy the application to Tomcat directly or by a war file.
  • Copy the cobertura.ser file to the current tomcat directory (tomcat / bin or system32, otherwise you will see the path in the error logs)
  • Use the application and stop the tomcat server.
  • Create a report with updated cobertura.ser (in system32 or ...) (at least for me the size does not change)

Link: - http://cobertura.sourceforge.net/faq.html - Answer by JB Nizet

+12
source

What does โ€œapplication not workingโ€ mean? Do you have an exception in tomcat pins / logs? What he says?

I suspect you forgot to put the cobertura banks in the WEB-INF / lib folder of your web server before deploying it. Obviously, addd code using the cobertura tool calls the methods of the cobertura mechanism, so these classes should be available in your webapp.

0
source

All Articles