TS 65 CallHierarchy

Call Hierarchy

Author: Petr Dvorak
Version: 6.5
Introduction: This document serves as a test specification for a "Java Call Hierarchy" feature. "Call Hierarchy" is a view that displays a tree representing hierarchy of callers or "callees" of a particular method (order of the items on the same level in the tree can vary, screenshots are informative only).
Comments: To reduce test specification length, TS is written so that test cases may depend on each other. Therefore, you need to perform steps in order if you are not familiar with how "Call Hierarchy" view works.

Test suite: Call Hierarchy

Setup:
- Start IDE with a fresh userdir. Download and unzip projects File:SampleProjects TS 65 CallHierarchy.zip CallHierarchy and CallHierarchyDep.
- Turn on line numbers by View>Show Line Numbers from the main menu, just to make work with this test specification more fluent.
- Open a sample project CallHierarchy

  1. Callers hierarchy
    1. Open file Main.java in editor
    2. Right-click the method "CapFirstLetter" on line 29 and invoke Call Hierarchy from popup menu
    3. Note: You can alternatively place a caret on "CapFirstLetter" (like "CapF|irstLetter") and invoke Window>Output>Call Hierarchy from the main menu - we will use popup menu in this test specification, but you may try to vary both methods
  2. Callers hierarchy - Show lines with method calls
    1. Click the sub-node main(String[[ | ]] args)::callhierarchy.Main in the tree
  3. "Callees" hierarchy
    1. Click Show Hierarchy of Callees toggle button in the "Java Call Hierarchy" view
  4. Call Hierarchy - Scope for invoking
    1. Right-click the comment on line 28 in main.java and invoke Call Hierarchy
    • EXPECTED RESULT:
      - Call Hierarchy for the right-clicked method (which is a "main" method in this case) is displayed in "Java Call Hierarchy" view.
      - Switching from Callers to Callees using toggle buttons works as expected (no methods calling "main" are displayed when exploring callers, methods called from "main" are displayed in the tree when exploring callees).
  5. Call Hierarchy - Refresh
    1. Right-click the comment on line 28 in main.java and invoke Call Hierarchy
    2. Click "Show Hierarchy of Callees" toggle button to show methods called from the "main" method
    3. Delete the first '/' character from the comment on the line 28 to comment-out a portion of code
    4. Click the Refresh button in "Java Call Hierarchy" view
    5. Add the '/' character back to uncomment a portion of code
    6. Click the Refresh button in "Java Call Hierarchy" view again
    • EXPECTED RESULT: Method "CapFirstLetter" is present in the call hierarchy tree (as a callee) if it is called in the main method (in other words, if it is not commented-out in the code).
  6. Call Hierarchy - Invoking outside method
    1. Right-click anywhere on line 1 and invoke Call Hierarchy
  7. Call Hierarchy - Recursive calls
    1. Open NewClassRecursive.java in the editor
    2. Invoke Call Hierarchy from the popup menu above the "fib" method on line 14
  8. Call Hierarchy - Go to source (First occurrence)
    1. Open NewClassRecursive.java in the editor
    2. Invoke Call Hierarchy from the popup menu above the "fib" method on line 14
    3. Double-click the only sub-node in the tree (the one with a badge indicating recursive call), or invoke Go to source from the popup menu above this sub-node
    • EXPECTED RESULT: You are navigated to the first call within the method fib.
  9. Call Hierarchy - Go to source (Particular occurrence)
    1. Open NewClassRecursive.java in the editor
    2. Invoke Call Hierarchy from the popup menu above the "fib" method on line 14
    3. Click the only sub-node in the tree (the one with a badge indicating recursive call) in order to display lines with method call in the bottom of "Java Call Hierarchy" view
    4. Double-click some of the lines with a method call or invoke Go to source from the popup menu
    • EXPECTED RESULT: You are navigated to the particular call you selected.
  10. Call Hierarchy - Expanding nodes
    1. Open NewClassCycle1.java in editor
    2. Invoke Call Hierarchy from the popup menu above the "gFunct" method on line 14 (you can view callers or callees)
    3. Expand all nodes in the tree
    4. Open main.java in the editor
    5. Invoke Call Hierarchy from the popup menu above the "CapFirstLetterOfEachWord" method on line 45
    6. Click Show Hierarchy of Callers to ensure you are viewing callers of "CapFirstLetterOfEachWord" method
    7. Expand all nodes in the tree again
  11. Call Hierarchy - Scope to Search
    1. Open main.java in the editor, if it is not already opened
    2. Invoke Call Hierarchy from the popup menu above the "CapFirstLetterOfEachWord" method on line 45
    3. Click Show Hierarchy of Callers (again, just to ensure you are viewing callers of "CapFirstLetterOfEachWord" method)
    4. Click Scope to Search button in the "Java Call Hierarchy" and choose Current Project from the popup menu
    5. Click Refresh button in the "Java Call Hierarchy" view
    6. Click Scope to Search button again and choose Open Projects
    7. Click Refresh button again
    • EXPECTED RESULT:
      - Call made from callhierarchydep.Main is not present in the results when you press the Refresh button for the first time, as it is not in the current project.
      - Call made from callhierarchydep.Main is again present in the results after you press the Refresh button for the second time.
  12. Call Hierarchy - Invoking in Java file
    1. Open file MyClass.java from project CallHierarchyDep (only the file, not the project)
    2. Right-click in the editor and see the popup menu ("Call Hierarchy" is disabled now)
    3. Double-click main(String[[ | ]] args)::callhierarchydep sub-node in the call hierarchy tree (should be still there from the previous case)
    4. When "callhierarchydep.Main" is opened, invoke popup menu above "CapFirstLetterOfEachWord" method on line 19 ("Call Hierarchy" is disabled now)
    5. Open project "CallHierarchyDep"
    6. Invoke popup menu above "CapFirstLetterOfEachWord" method on line 19 in callhierarchydep.Main class again
    • EXPECTED RESULT:
      - Popup menu item "Call Hierarchy" is enabled only in case that project is opened - it is not enabled in case that only a file is opened.
      - Popup menu is enabled in a file after a project containing that file is opened in IDE.


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