TS 71 InspectAndRefactor

(Difference between revisions)
(Created page with '==inspect And Refactor== '''Author:'''Jiri Prox<br/> '''Version:'''7.1<br/> '''Last update:'''2011/09/27<br/> '''Introduction:'''This is test specification for Inspect and Refato…')
(inspect And Refactor)
 
Line 1: Line 1:
-
==inspect And Refactor==
+
==Inspect And Transform==
'''Author:'''Jiri Prox<br/>
'''Author:'''Jiri Prox<br/>
'''Version:'''7.1<br/>
'''Version:'''7.1<br/>
-
'''Last update:'''2011/09/27<br/>
+
'''Last update:'''2011/10/06<br/>
-
'''Introduction:'''This is test specification for Inspect and Refator feature. TBD<br/>
+
'''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.<br/>
__TOC__
__TOC__
-
====Test suite: Applying Single Hint====
+
====Test suite: Applying Hints====
-
 
+
# {{testcase|Single Hint w/o refactoring}}
-
====Test suite: Applying set of hints====
+
## Open ''InspectRefactor.java'' from the attached project
 +
## Open ''Inspect&Transform'' dialog
 +
## Select '''Single Inspection''' and choose '''Assignment to method parameter'''
 +
## Press '''Inspect'''
 +
#* {{result|EXPECTED RESULT:   One occurrence is found and showed in refactoring preview window  }}
 +
# {{testcase|Single hint  with refactoring}}
 +
## Open ''InspectRefactor.java'' file and open ''Inspect&Transform'' dialog
 +
## Select '''Single Inspection''' and choose '''Assignment replaceble with operator ...''' hint
 +
## Press '''Inspect'''
 +
## Check suggested changes in preview panel and accept them by pressing '''Do Refactoring'''
 +
#* {{result|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  }}
 +
# {{testcase|Preview panel}}
 +
## Repeat previous testcase until refactoring preview is shown
 +
## Try functionality of each button in the left part of preview part of the preview window
 +
## Try unchecking some checkbox in the tree
 +
## Cancel refactoring
 +
#* {{result|EXPECTED RESULT:    The buttons in the left has correct behaviour. Refresh button reopens ''Inspect&Transform''' dialog.    }}
 +
# {{testcase|No patterns found}}
 +
## Open ''InspectRefactor.java''' file and show ''Inspect&Transform'' dialog
 +
## Select '''Single Inspection''' and choose '''Nested assignment'''
 +
## Press '''Inspect'''
 +
#* {{result|EXPECTED RESULT:  Dialog with text '''No pattern is found'''' is opened  }}
 +
# {{testcase|Predefined set of hints}}
 +
## Open ''PredefinedSet.java''' and open ''Inspect&Transform''' dialog
 +
## Select '''Configuration''' and choose '''Convert to JDK 7'''
 +
## Press '''Inspect'''
 +
## Apply suggested refactoring
 +
#* {{result|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====
====Test suite: Managing Configurations====
 +
# {{testcase|Create new configuration}}
 +
## Open ''Inspect & Transform'' dialog
 +
## Select '''Configuration''' and press '''Manage...''' button
 +
## From configurations combo box select ''New...''
 +
## Type name of new configuration
 +
## Choose  set of hints
 +
## Apply set of hint to the code
 +
#* {{result|EXPECTED RESULT:      New configuration is created and can by applied to the code  }}
 +
# {{testcase|Update configuration}}
 +
## Open Inspect & Transform dialog
 +
## Press '''Manage ...''' to update configuration
 +
## Select configuration created in previous test case
 +
## Update set of hint - add some and remove the original ones
 +
## Apply modified configuration to the code
 +
#* {{result|EXPECTED RESULT:  Configuration is modified, hints removed are not used any more,  }}
 +
# {{testcase|Rename configuration}}
 +
## Open ''Inspect & Transform'' dialog
 +
## Press '''Manage ...''' to update configuration
 +
## Select configuration from previous testcase
 +
## Select rename and type new name
 +
#* {{result|EXPECTED RESULT:  Configuration is renamed  }}
 +
# {{testcase|Duplicate configuration}}
 +
## Open ''Inspect & Transform'' dialog
 +
## Press '''Manage ...''' to update configuration
 +
## Select configuration from previous testcase
 +
## Select duplicate and type new name
 +
## Try applying new configuration to the code
 +
#* {{result|EXPECTED RESULT:  The configuration is copied - the selected hints are the same as in original configuration  }}
 +
# {{testcase|Delete configuration}}
 +
## Open ''Inspect & Transform'' dialog
 +
## Press '''Manage ...''' to update configuration
 +
## Select configuration from previous testcase
 +
## Select '''delete''' from the configurations combo box
 +
#* {{result|EXPECTED RESULT:  Configuration is deleted  }}
 +
 +
====Test suite: Scope====
 +
# {{testcase|File scope}}
 +
## Open ''InspectRefactor.java''
 +
## Open ''Inspect & Transform'' dialog
 +
## Select single inspection - ''Assignment to method parameter''
 +
## Select ''Current File'' scope
 +
## Press '''Inspect'''
 +
#* {{result|EXPECTED RESULT:  Only occurrences from current file are found  }}
 +
# {{testcase|Package scope}}
 +
## Repeat previous testcase but select ''Current package'' scope
 +
#* {{result|EXPECTED RESULT:  Occurrences from current package are found (2 occurrences)  }}
 +
# {{testcase|Actual project scope}}
 +
## Repeat previous testcase but select ''Current project'' scope
 +
#* {{result|EXPECTED RESULT:  Occurrences from current project are found (3 occurrences)  }}
 +
# {{testcase|All opened project}}
 +
## Repeat previous testcase but select ''All projects'' scope
 +
#* {{result|EXPECTED RESULT:  Occurrences from all project are found  }}
 +
# {{testcase|Custom scope}}
 +
## Repeat previous testcase but select ''Custom'' scope
 +
## Press '''...''' button next to the selected scope
 +
## Customize scope by checking/un-checking boxes
 +
## Confirm scope by '''OK''' button and press '''Inspect'''
 +
#* {{result|EXPECTED RESULT:  Occurrences are found only in selected scope  }}
 +
# {{testcase|Preset scope}}
 +
## Invoke Inspect&Transform from editor
 +
## Invoke Inspect&Transform from context menu in project view - file node
 +
## Invoke Inspect&Transform from context menu in project view - package node
 +
## Invoke Inspect&Transform from context menu in project view - project node
 +
#* {{result|EXPECTED RESULT:  Every time dialog is opened, the scope is set according the position where it was invoked  }}
====Test suite: Custom Hints====
====Test suite: Custom Hints====
 +
# {{testcase|Creating custom hint}}
 +
## Open ''Inspect&Transform'' dialog
 +
## Press '''Manage ...''' for single inspection
 +
## Press '''New...''' in the bottom of the dialog
 +
## Apply new hint to the ''Custom.java''
 +
#* {{result|EXPECTED RESULT:  New hint ''HintSample'' is created with default script, after applying on ''Custom.java'' one part of code is modified  }}
 +
# {{testcase|Editing script}}
 +
## Open Inspect&Transform and press '''Manage''' for single inspection
 +
## Select hint created in previous test case
 +
## press '''Edit  Script'''
 +
## make some modification and press '''Cancel'''
 +
## Press '''Edit Script''' again
 +
## Remove all '{' and '}' in the script editor
 +
## Apply the hint to the ''Custom.java''
 +
#* {{result|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.  }}
 +
# {{testcase|Opening script in editor}}
 +
## Open script for editing as in previous test case
 +
## Press '''Open In Editor'''
 +
## Do some modifications and save the file
 +
#* {{result|EXPECTED RESULT:  Script is opened in editor, after saving the file the hint itself is modified  }}
 +
# {{testcase|Renaming hint}}
 +
## Open Inspect&Transform and press '''Manage ...''' for  single inspection
 +
## Select some custom hint
 +
## Right click and from context menu select '''Rename'''
 +
## Try also clicking on hint name or pressing F2 to start renaming mode
 +
## Type new name and confirm it by enter
 +
#* {{result|EXPECTED RESULT:  Hint is rename  }}
 +
# {{testcase|Deleting hint}}
 +
## Repeat previous test case but instead of '''Rename''' choose '''Delete''' from contex menu
 +
#* {{result|EXPECTED RESULT:  Hint is deleted. After deleting last custom hint the whole 'Custom' branch  is hidden  }}
 +
 +
{{attachments|
 +
* [[Media:TS71-InspectRefactor.zip]]}}

Current revision as of 08:28, 6 October 2011

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