TS 73 FindBugs

Findbugs integration

Author:Jiri Prox jiri.prox@oracle.com
Version:7.3
Last update:2012/11/09
Introduction:This test specification covers integration of FindBugs analyzer. It test installation of the plugin, checking single or multiple rules, integration into the hint infrastructure.

Contents

Test suite: Installation

  1. Check plugin installation
    1. Open any java file
    2. Call Inspect
    3. Try selecting All Analyzers or Findbugs predefined configuration
    • EXPECTED RESULT:If All analyzers configuration is selected, there should be warning "Missing plugin" and the install button. Fingbugs configuration is blocked, there should be error message.
  2. Install plugin
    1. Open Inspect dialog
    2. Press Install
    3. Install required plugin (restart is not required)
    4. Repeat previous test case
    • EXPECTED RESULT:After installation, there is no more any warning of error message in the Inspect dialog, the inspection can be launched normally.

Test suite: Inspection

  1. Run single inspection
    1. Open Findbugs.java from the attached project
    2. Open Inspect dialog
    3. Select Single inspection and select Class implements Cloneable but does not define clone() method (12th in Bad Practice category)
    4. Run inspection
    • EXPECTED RESULT:The Single inspection combobox contains rules added by FindBugs plugin. There is one code issue at line 7. The result window behaves exactly as common hint is used (specified in Inspection&Transform test specification)
  2. Run predefined configuration
    1. Open Findbugs class
    2. Open Inspect dialog
    3. Select Configuration and choose Findbugs analyzer
    4. Run inspection
    • EXPECTED RESULT:The all enabled rules of FindBugs plugin are applied. There should be 3 code issue in the current class
  3. Create new configuration
    1. Open Inspect dialog
    2. Select Configuration and press Manage
    3. Select New... from configuration combobox
    4. Type new name
    5. Select Findbugs analyzer and select all Dodgy code rules
    6. Press OK and run newly created inspection
    • EXPECTED RESULT:The new configuration is created, when launched it finds 2 code issue
  4. Editing configuration
    1. Open Inspect dialog
    2. Select Configuration and press Manage
    3. Select configuration created in previous test case
    4. Switch analyzer to Netbeans Java Hints
    5. Select all Assignment issues rules
    6. Press Ok and run configuration
    • EXPECTED RESULT:3 code issues are found - 2 from FindBugs and 1 from Netbeans Java Hints

Test suite: Integrations into hints infrastructure

  1. Options
    1. Open Options dialog
    2. Open Editor -> Hints
    3. Select Findbugs as language
    • EXPECTED RESULT:There is whole tree of Findbugs rules. The tree works the same as for hints (description when leaf is selected, search, selecting while branch etc...)
  2. Displaying hints in editor
    1. Open Options dialog
    2. Open Editor -> Hints
    3. Select Findbugs as language
    4. Check Run Findbugs in Editor checkbox
    5. Open Findbug.java
    • EXPECTED RESULT:From now on, the breaking of FindBugs rule are indicated directly in editor as warning hints
  3. Applying hint
    1. Open FindBugs.java
    2. Enable running FindBugs in editor
    3. put cursor at line 14 and press alt-enter
    4. Apply hint
    5. Again press alt-enter and line 14 and press right arrow to get next popup
    6. Try all items from the second popup.
    • EXPECTED RESULT:The hint can by applied in 4 ways:
      • it can be directly disabled
      • it can be customized: the hint tree is opened, related leaf is selected
      • the Inspect for the actual hint can be launched
      • suppress annotation can be added

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo