2011-03-14 84 views
7

我正在嘗試使用Cobertura應用代碼覆蓋。該應用程序是在Tomcat 5中部署的 ,但是當我測試.class文件時, 應用程序停止工作。Tomcat上的Cobertura

這是我的步驟:

  • 編譯應用程序(此運行在Tomcat中)
  • 儀器類文件。

    D:\test\cobertura-1.9.4.1\cobertura-instrument.bat --destination D:\test\instrument D:\src\path_to_app\main\target\webapp 
    
  • 覆蓋的D:\src\path_to_app\main\target\webapp 類文件與儀表類文件D:\test\instrument

  • 通過Catalina conf或war文件在Tomcat中部署應用程序。 (該 應用程序無法正常工作)

是否有人有正確Tomcat中 與儀表的Cobertura類部署應用程序的正確步驟是什麼?

參考:http://cobertura.sourceforge.net/faq.html

我使用的Cobertura-1.9.4.1

回答

11

正確的步驟是:

  • 編譯應用程序
  • 儀器類文件。 D:\test\cobertura-1.9.4.1\cobertura-instrument.bat --destination D:\test\instrument D:\src\path_to_app\main\target\webapp(一cobertura.ser其創建)

  • 覆蓋的D:\src\path_to_app\main\target\webapp 類文件與儀表類文件D:\test\instrument

  • 將cobertura.jar複製到WEB-INF/lib
  • 直接或通過war文件在Tomcat中部署應用程序。
  • 將cobertura.ser複製到tomcat的當前目錄(tomcat/bin或system32,否則你會在錯誤日誌中看到路徑)
  • 使用該應用程序並停止tomcat服務器。
  • 建立與更新cobertura.ser報告(在SYSTEM32或...)(至少對我來說,大小不會改變)

參考: - http://cobertura.sourceforge.net/faq.html - JB Nizet答案

+0

人們很難理解這種偉大的答案。謝謝你,兄弟。 +100500加入你的carma。 – 2015-04-09 18:10:33

0

什麼是 「應用程序不工作」 是什麼意思?你在tomcat輸出/日誌中有例外嗎?它說什麼?

我懷疑在部署它之前,忘記將cobertura jar放在webapp的WEB-INF/lib文件夾中。顯然,由cobertura工具添加的代碼調用cobertura引擎的方法,因此這些類必須在您的web應用程序中可用。

+0

錯誤404,謝謝,我會試試看。 – Gareve 2011-03-14 23:39:01