TS 71 InspectAndRefactor

Inspect And Transform

Author:Jiri Prox
Version:7.1
Last update:2011/10/06
Introduction:This is test specification for Inspect and Refactor feature. This functionality allows user to run set of refactoing (hints) and once on the selected scope of files. User can even define his own hint.

Contents

Test suite: Applying Hints

  1. Single Hint w/o refactoring
    1. Open InspectRefactor.java from the attached project
    2. Open Inspect&Transform dialog
    3. Select Single Inspection and choose Assignment to method parameter
    4. Press Inspect
    • EXPECTED RESULT: One occurrence is found and showed in refactoring preview window
  2. Single hint with refactoring
    1. Open InspectRefactor.java file and open Inspect&Transform dialog
    2. Select Single Inspection and choose Assignment replaceble with operator ... hint
    3. Press Inspect
    4. Check suggested changes in preview panel and accept them by pressing Do Refactoring
    • EXPECTED RESULT: One occurrence of replacable assignment is found. In preview there is suggested how to replace it with one operator. After pressing Do Refactoring the suggested changes are applied in code
  3. Preview panel
    1. Repeat previous testcase until refactoring preview is shown
    2. Try functionality of each button in the left part of preview part of the preview window
    3. Try unchecking some checkbox in the tree
    4. Cancel refactoring
    • EXPECTED RESULT: The buttons in the left has correct behaviour. Refresh button reopens Inspect&Transform' dialog.
  4. No patterns found
    1. Open InspectRefactor.java' file and show Inspect&Transform dialog
    2. Select Single Inspection and choose Nested assignment
    3. Press Inspect
    • EXPECTED RESULT: Dialog with text No pattern is found' is opened
  5. Predefined set of hints
    1. Open PredefinedSet.java and open Inspect&Transform dialog
    2. Select Configuration and choose Convert to JDK 7
    3. Press Inspect
    4. Apply suggested refactoring
    • EXPECTED RESULT: Changes conversing project to JDK 7 syntax are suggested (In preview there are 13 occurrence provided) after applying changes the code is changed - diamond operator, string switch and try with resources are provided

Test suite: Managing Configurations

  1. Create new configuration
    1. Open Inspect & Transform dialog
    2. Select Configuration and press Manage... button
    3. From configurations combo box select New...
    4. Type name of new configuration
    5. Choose set of hints
    6. Apply set of hint to the code
    • EXPECTED RESULT: New configuration is created and can by applied to the code
  2. Update configuration
    1. Open Inspect & Transform dialog
    2. Press Manage ... to update configuration
    3. Select configuration created in previous test case
    4. Update set of hint - add some and remove the original ones
    5. Apply modified configuration to the code
    • EXPECTED RESULT: Configuration is modified, hints removed are not used any more,
  3. Rename configuration
    1. Open Inspect & Transform dialog
    2. Press Manage ... to update configuration
    3. Select configuration from previous testcase
    4. Select rename and type new name
    • EXPECTED RESULT: Configuration is renamed
  4. Duplicate configuration
    1. Open Inspect & Transform dialog
    2. Press Manage ... to update configuration
    3. Select configuration from previous testcase
    4. Select duplicate and type new name
    5. Try applying new configuration to the code
    • EXPECTED RESULT: The configuration is copied - the selected hints are the same as in original configuration
  5. Delete configuration
    1. Open Inspect & Transform dialog
    2. Press Manage ... to update configuration
    3. Select configuration from previous testcase
    4. Select delete from the configurations combo box
    • EXPECTED RESULT: Configuration is deleted

Test suite: Scope

  1. File scope
    1. Open InspectRefactor.java
    2. Open Inspect & Transform dialog
    3. Select single inspection - Assignment to method parameter
    4. Select Current File scope
    5. Press Inspect
    • EXPECTED RESULT: Only occurrences from current file are found
  2. Package scope
    1. Repeat previous testcase but select Current package scope
    • EXPECTED RESULT: Occurrences from current package are found (2 occurrences)
  3. Actual project scope
    1. Repeat previous testcase but select Current project scope
    • EXPECTED RESULT: Occurrences from current project are found (3 occurrences)
  4. All opened project
    1. Repeat previous testcase but select All projects scope
    • EXPECTED RESULT: Occurrences from all project are found
  5. Custom scope
    1. Repeat previous testcase but select Custom scope
    2. Press ... button next to the selected scope
    3. Customize scope by checking/un-checking boxes
    4. Confirm scope by OK button and press Inspect
    • EXPECTED RESULT: Occurrences are found only in selected scope
  6. Preset scope
    1. Invoke Inspect&Transform from editor
    2. Invoke Inspect&Transform from context menu in project view - file node
    3. Invoke Inspect&Transform from context menu in project view - package node
    4. Invoke Inspect&Transform from context menu in project view - project node
    • EXPECTED RESULT: Every time dialog is opened, the scope is set according the position where it was invoked

Test suite: Custom Hints

  1. Creating custom hint
    1. Open Inspect&Transform dialog
    2. Press Manage ... for single inspection
    3. Press New... in the bottom of the dialog
    4. Apply new hint to the Custom.java
    • EXPECTED RESULT: New hint HintSample is created with default script, after applying on Custom.java one part of code is modified
  2. Editing script
    1. Open Inspect&Transform and press Manage for single inspection
    2. Select hint created in previous test case
    3. press Edit Script
    4. make some modification and press Cancel
    5. Press Edit Script again
    6. Remove all '{' and '}' in the script editor
    7. Apply the hint to the Custom.java
    • EXPECTED RESULT: Modifications are not saved when ending editing with Cancel. Changes are saved after pressing Save. The modified script changes two parts of the code.
  3. Opening script in editor
    1. Open script for editing as in previous test case
    2. Press Open In Editor
    3. Do some modifications and save the file
    • EXPECTED RESULT: Script is opened in editor, after saving the file the hint itself is modified
  4. Renaming hint
    1. Open Inspect&Transform and press Manage ... for single inspection
    2. Select some custom hint
    3. Right click and from context menu select Rename
    4. Try also clicking on hint name or pressing F2 to start renaming mode
    5. Type new name and confirm it by enter
    • EXPECTED RESULT: Hint is rename
  5. Deleting hint
    1. Repeat previous test case but instead of Rename choose Delete from contex menu
    • EXPECTED RESULT: Hint is deleted. After deleting last custom hint the whole 'Custom' branch is hidden
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