TS 74 CallHierarchy

Call Hierarchy

Author:Petr Dvorak, Standa Sazonov, Jiri Prox
Version:7.4
Last update:2013/07/19
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).

Contents

Test suite: Call Hierarchy

  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
    • EXPECTED RESULT:
      - New view with a title Java Call Hierarchy is shown in the bottom of the editor.
      - A tree representing all callers of the method is shown (there is only one caller in this case)
      - Show Hierarchy of Callers toggle button is selected.

      image:testcase1_TS_74_CallHierarchy.png
  2. Callers hierarchy - Show lines with method calls
    1. Click the sub-node main(String[[ | ]] args)::callhierarchy.Main in the tree
    • EXPECTED RESULT: A line with the method call is shown in the bottom part of the "Java Call Hierarchy" view (it is a single line in this case). The called method is in a boldface on the line.

      image:testcase2_TS_74_CallHierarchy.png
  3. "Callees" hierarchy
    1. Click Show Hierarchy of Callees toggle button in the "Java Call Hierarchy" view
    • EXPECTED RESULT:
      - All methods that are invoked within method "CapFirstLetter" are shown in the hierarchy view.
      - Clicking the particular tree item displays lines with a method call in the bottom part of a "Java Call Hierarchy" view.

      image:testcase3_TS_74_CallHierarchy.png
  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
    • EXPECTED RESULT: "Select some method to explore" is written in "Java Call Hierarchy" view.

      image:testcase4_TS_74_CallHierarchy.png
  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
    • EXPECTED RESULT: Call Hierarchy for the current method is shown. Tree contains only one sub-node, this sub-node has a little badge suggesting recursive call. Results are the same for callers and callees in this case, there are two lines with usage displayed when you click the caller's/callee's node.

      image:testcase5_TS_74_CallHierarchy.png
  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
    • EXPECTED RESULT: Sub-nodes can be expanded to show callers of callers (callees of callees, respectively). Cyclic calls do not cause any problems and are marked with the same badge as recursive calls.

      image:testcase6_TS_74_CallHierarchy.png
  11. Call Hierarchy - Invoking on constructor
    1. Open ClassA.java in editor
    2. Invoke Call Hierarchy from the popup menu above the "ClassC()t" constructor on line 29
    3. Select "Show hierarchy of callers"
    • EXPECTED RESULT:There are 2 subnodes of ClassC() in Java Call Hierarchy
  12. 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.
  13. Call Hierarchy - Search from base class
    1. Open BaseClass.java in editor
    2. Put cursor on Sub.method() and invoke Call Hierarchy
    3. In the result window, click on the Filter icon (bottom in the left part) and from the popup enable 'Search from the base class'
    4. Refresh the result
    • EXPECTED RESULT:If 'Search from the base class' is enabled, then 2 callers of the method() are found - one at line 21 and second on the line 22. If 'Search from the base class' is disabled, only one caller on line 22 is found
  14. Call Hierarchy - Search in test
    1. Open BaseClass.java in editor
    2. Put cursor on BaseClass.usages() and invoke Call Hierarchy
    3. In the result window, click on the Filter icon (bottom in the left part) and from the popup enable 'Search unit tests'
    4. Refresh the result
    • EXPECTED RESULT:One caller of method usages() is found in the tests
  15. 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