您的位置:軟件測試 > 開源軟件測試 > 開源單元測試工具 >
在eclipse中使用findbug
作者:網(wǎng)絡轉載 發(fā)布時間:[ 2013/2/18 13:32:48 ] 推薦標簽:

  1. Run FindBugs Automatically開關

     當此項選中后,F(xiàn)indBugs將會在你修改Java類時自動運行,如你設置了Eclipse自動編譯開關后,當你修改完Java文件保存,F(xiàn)indBugs會運行,并將相應的信息顯示出來。

     當此項沒有選中,你只能每次在需要的時候自己去運行FindBugs來檢查你的代碼。

  2. Minimum priority to report選擇項

     這個選擇項是讓你選擇哪個級別的信息進行顯示,有Low、Medium、High三個選擇項可以選擇,很類似于Log4J的級別設置啦。 比如:

     你選擇了High選擇項,那么只有是High級別的提示信息才會被顯示。

     你選擇了Medium選擇項,那么只有是Medium和High級別的提示信息才會被顯示。

     你選擇了Low選擇項,那么所有級別的提示信息都會被顯示。

  3. Enable bug categories選擇項

     在這里是一些顯示Bug分類的選擇:

     Correctness關于代碼正確性相關方面的

     Performance關于代碼性能相關方面的

     Internationalization關于代碼國際化相關方面的

     Multithreaded correctness關于代碼多線程正確性相關方面的

     Style關于代碼樣式相關方面的

     Malicious code vulnerability關于惡意破壞代碼相關方面的

     比如:如果你把Style的檢查框去掉不選擇中它,那么與Style分類相關的警告信息不會顯示了。其它的類似。

  4. Select bug patterns to check for選擇項

     在這里你可以選擇所要進行檢查的相關的Bug Pattern條目

     可以從Bug codes、Detector name、Detector description中看到相應的是要檢查哪些方面的內容,你可以根據(jù)需要選擇或去掉相應的 檢查條件。

  總結

  此插件的功能很不錯,可以幫助我們提升Java代碼的編寫能力,寫出更加安全可靠的代碼。建議使用或加在Ant里進行持續(xù)構建。

  現(xiàn)在,你可以馬上拿出你已經開發(fā)的一個項目,檢查一下你的代碼有沒有問題了。
剛剛發(fā)現(xiàn)了另外一種更加簡單的安裝方法,詳情見:http://findbugs.cs.umd.edu/eclipse
   If you have previously installed a version of the FindBugs plugin prior to mid-May, 2006, then you should remove it first. Simply remove the de.tobject.findbugs_0.0.n directory from Eclipse's plugins directory.

To install the FindBugs plugin:

  1. In Eclipse, click on Help -> Software Update -> Find and Install...
  2. Choose the Search for new features to install option, and click Next.
  3. Click New Remote Site.
  4. Enter the following:
         * Name: FindBugs update site
         * URL: one of the following (note: no final slash on the url)
               o http://findbugs.cs.umd.edu/eclipse for official releases
               o http://findbugs.cs.umd.edu/eclipse-candidate for candidate releases and official releases
               o http://findbugs.cs.umd.edu/eclipse-daily for all releases, inculding developmental ones
     and click OK.
  5. "FindBugs update site" should appear under Sites to include in search.
     Click the checkbox next to it to select it, and click Finish.
  6. You should see FindBugs Feature under Select features to install.
     (You may have to click on one or two triangles to make it visible in the tree.)
     Select the checkbox next to it and click next.
  7. Select the I accept option to accept the license and click Next.
  8. Make sure the location is correct where you're installing it. The default (your workspace) should be fine. Click Finish.
  9. The plugin is not digitally signed. Go ahead and install it anyway.
 10. Click Yes to make Eclipse restart itself.

上一頁1234下一頁
軟件測試工具 | 聯(lián)系我們 | 投訴建議 | 誠聘英才 | 申請使用列表 | 網(wǎng)站地圖
滬ICP備07036474 2003-2017 版權所有 上海澤眾軟件科技有限公司 Shanghai ZeZhong Software Co.,Ltd