TS 74 JavaNavigation

Java Navigation

Author:Jiri Prox
Version:7.4
Last update:2013/06/26
Introduction:

Contents

Test suite: Go To Navigation

  1. Go To Source - class
    1. Open navigation.GoToSource from the sample project
    2. Put caret on line 30 word Declaration
    3. from context menu call Navigate | Go To Source
    • EXPECTED RESULT:The class Decalaration is opened, cursor is moved at the class declaration
  2. Go To Source - method
    1. Open navigation.GoToSource from the sample project
    2. Put caret on line 31 word method
    3. from main menu call Navigate | Go To Source
    • EXPECTED RESULT:Declaration class is opened, cursor is moved to proper place
  3. Go To Source - no sources
    1. Open navigation.GoToSource from the sample project
    2. Put caret on line 32 word String
    3. Use Ctrl-B to invoke go to source
    • EXPECTED RESULT:Decompiled class is opened (there are only methods declarations, bodies are only in bytecode in comments
  4. Go To Declaration
    1. Open navigation.GoToSource from the sample project
    2. Put caret on line 30 word Declarations
    3. From context menu call Navigate | Go To Declaration
    • EXPECTED RESULT:Declaration class is opened, cursor is moved at the proper place
  5. Go to declaration - local variable
    1. Open navigation.GoToSource from the sample project
    2. Put cursor on dec at line 31 and press Ctrl-B
    • EXPECTED RESULT:Cursor is moved to declaration of variable dec
  6. Go To Super Implementation
    1. Open navigation.GoToSource from the sample project
    2. put caret at method toString
    3. class Navigate -> Go To Super Implementation from context menu (or use Ctrl-Shift-P)
    • EXPECTED RESULT:Cursor is moved to implementation of the current method in the superclass - e.g. to the class Object
  7. Ctrl-click
    1. Open GoToSource
    2. press click and hover over dec at line 31
    3. ctrl-click at dec
    • EXPECTED RESULT:When hovering over the element while ctrl is pushed, the element is blue underlined and small popup containing navigation.GoToSource dec is opened. Ctrl-click work as go to declaration.
  8. Ctrl-alt-click
    1. Open SuperClass
    2. Press ctrl-alt and hover mouse over test at line 34
    3. Perform ctrl-alt-click
    4. Select some item from the list (either by mouse or by arrow keys and enter)
    • EXPECTED RESULT:Hovering over method name open popup - method overriding test(). When clicked small list is opened, containing all methods overriding the selected one. Click on some item will open the related class and moves the cursor at the declaration of overriding method
  9. Jump to overriding method
    1. Open SuperClass
    2. Go to line 34, there should by gray icon containing 'O' in the gutter
    3. Click on the icon (or use Ctrl-Alt-B)
    • EXPECTED RESULT:Popup containing all overriding methods is opened as in previous test case. Selecting one will open related method declaration.
  10. Jump to super method
    1. Open SuperClass
    2. Go to line 24, there should by green icon containing 'I' in the gutter
    3. Click on the icon (or use Ctrl-Shift-P)
    • EXPECTED RESULT:The Runnable interface is opened, cursor is moved to the method declaration.

Test suite: Go To Type

Purpose: This test suite covers Go To Type dialog witch all its functionality

  1. Basic case
    1. Open Go To Type dialog (ctrl-O)
    2. Start typing name of any class
    3. Use arrow key to browse in the list
    4. Select required class and press Enter
    • EXPECTED RESULT:The list of classes is updated immediately while writing. The list can be browsed by arrows keys and PageUp/Page Down. The Location text field shows the origin of the currently selected class. Enter open the selected class.
  2. Negative case
    1. Open Go To Type dialog
    2. Type name of not existing class, e.g. "ThisClassDoesNotExists"
    • EXPECTED RESULT:"<No Types Found>" is displayed
  3. Pre-filled values
    1. Open any java file
    2. Put cursor at any class, method or variable in the code and open Go To Type dialog
    3. Put cursor at any keyword and open Go To Type dialog
    • EXPECTED RESULT:When cursor is placed over some identifier, the identifier is copied into the Type Name textfield. Otherwise name of actual class is used.
  4. Capital letters
    1. Open Go To Type dialog
    2. Type only capital letters - for example DTM
    • EXPECTED RESULT:The list contains classes which matches the name (DTM), and the classes which capital letters match the given pattern (DefautTableModel, DefaultTreeModel)
  5. Case sensitive
    1. Open Go To Type dialog
    2. Check Case Sensitive checkbox
    3. Type any class name, but only in lower case (for example "system")
    • EXPECTED RESULT:No classes are found
  6. Wildcards
    1. Open Go To Type dialog
    2. Type any class name, use ? for single letter, * for 0 or more letters and space at the end for exact match
    • EXPECTED RESULT:Wildcards works as expected
  7. Fully qualified name
    1. Open Go To Type dialog
    2. Type any class by FQN, for example java.io.IOException
    • EXPECTED RESULT:The class is correctly found. Note that you can get list of all classes in package by typing only package name (java.io.), this list contains also anonymous classes (named 1,2 etc...)
  8. FQN - first letters
    1. Open Go To Type dialog
    2. type any class name using FQN, but use only first letters - e.g. j.a.i.Data
    • EXPECTED RESULT:Several classes beginning with Data from java.awt.image are found
  9. Highlight matching
    1. Open Go To Type dialog
    2. Use any of previous test cases or combination
    • EXPECTED RESULT:Each item in the list has highlighted by bold the part which match the pattern in Type Name text field
  10. Incomplete results
    1. Open any larger project (e.g. Netbeans sources)
    2. Open Go To Type dialog
    3. Search for some class
    • EXPECTED RESULT:In the list there is warning that the sources may be incomplete

Test suite: Go To File

  1. Basic use case
    1. Open Go To File dialog by pressing Alt-Shift-O
    2. Type name of any file in the project directory (e.g. manifest.mf)
    3. Select some item and confirm by Enter
    • EXPECTED RESULT:List of found files in opened projects are listed. Each item of the list has correct value Location which shows where is the file physically stored. At the right side of each item, there is project which the file belongs to. After confirmation the selected file is opened
  2. Wildcards
    1. Open Go To File dialog by pressing Alt-Shift-O
    2. Type any name using the wildcards (e.g. *.txt)
    • EXPECTED RESULT:All matching files are correctly found
  3. Case sensitivity
    1. Open Go To File dialog by pressing Alt-Shift-O
    2. Check Case sensitive check box
    3. Type name of existing file but with incorrect capital letters
    • EXPECTED RESULT:No files are found, until search is turned to case insensitive again
  4. Prefer Current Project
    1. Open Go To File dialog by pressing Alt-Shift-O
    2. Type a file which exists in more project (e.g. build.xml)
    3. Check Prefer current project checkbox
    • EXPECTED RESULT:The files from actual project are moved at top of the list (current project is determined from the place where the go to file was invoked from)
  5. Line Numbers
    1. Open Go To File dialog by pressing Alt-Shift-O
    2. Type name of existing file followed by ':' and line number
    3. Press Enter
    • EXPECTED RESULT:Selected file is opened and cursor is placed at specified position

Test suite: Go To Symbol

  1. Basic Case
    1. Open Go To Symbol dialog (ctrl-alt-shift-O)
    2. Type name of the class (e.g. Declaration)
    3. Type name of constructor (e.g. GoToSource )
    4. Type named of method (e.g. perform)
    • EXPECTED RESULT:Each time, correct elements are found and listed in the dialog. Each item in the list has correct name and icon, project name where the element belongs to (if available) and the location. After pressing Enter the related file is opened and cursor is places at the declaration.
  2. Wildcards
    1. Repeat previous testcase, but use "?" "*" wildcards
    • EXPECTED RESULT:
  3. Case Sensitivity
    1. Open Go To Symbol dialog (ctrl-alt-shift-O)
    2. Type name of some element, but with incorrect capital letters
    3. Check Case Sensitive checkbox
    • EXPECTED RESULT:No elements are found if the search is case sensitive
  4. SubClasses
    1. Open Go To Symbol dialog (ctrl-alt-shift-O)
    2. Type ClassStructure.Inn
    • EXPECTED RESULT:The Go To Symbol Dialog shows Inner class which is nested in ClassStructure class
  5. Fully Qualified Named
    1. Open Go To Symbol dialog (ctrl-alt-shift-O)
    2. Type navigation.*
    • EXPECTED RESULT:The Go To Symbol Dialog shows all classes in the given package
  6. Class Members
    1. Open Go To Symbol dialog (ctrl-alt-shift-O)
    2. Type ClassStructure.*
    • EXPECTED RESULT:The Go To Symbol Dialog shows symbols in the given class

Test suite: Navigator Window

Purpose: Navigator window, located below the project view, displays inner structure of the selected class. It can be filtered and sorted. Double click on tree list will bring cursor to the source (Go To Source function)

  1. Class Structure
    1. Open navigator.ClassStructure from sample project
    2. Check content of navigator
    • EXPECTED RESULT: Image:navigator-class_TS_73_Java.png
  2. Annotation Structure
    1. Open navigator.AnnotationStructure from sample project
    2. Check content of navigator
    • EXPECTED RESULT: Image:navigator-annotation_TS_73_Java.png
  3. Enum Structure
    1. Open navigator.EnumStructure from sample project
    2. Check content of navigator
    • EXPECTED RESULT: Image:navigator-enum_TS_73_Java.png
  4. Filters
    1. Open navigator.ClassStructure from sample project
    2. Change navigator filters - use buttons and context menu
    3. Each time check context of navigator
    • EXPECTED RESULT: - Show Inherited Members : Shows also members from all superclasses</br>

- Show Fields: hides/shows fields - Show Static Members: hides/shows static members (methods, fields, inner classes ....) - Show Non Public Members: if turned off, only public members are displayed - Show Inner Classes: hides/shows inner classes - Fully qualified names: toggles usages of FQN instead of simple name - Sort By Name : members are sorted by their name - Sort By Source : members are sorted by their position in source file (the last two filters are mutaly exclusive)

  1. Context menu
    1. Open navigator.ClassStructure from sample project
    2. Right click on navigator
    • EXPECTED RESULT:The menu contains all functionality, which can be done be filters buttons
  2. Navigation To Source
    1. Open navigator.ClassStructure from sample project
    2. Double click on any item
    • EXPECTED RESULT:Cursor is located at the declaration of selected member
  3. Javadoc
    1. Open navigator.ClassStructure from sample project
    2. Hover mouse over some item
    • EXPECTED RESULT:Popup with javadoc is opened. Ctrl-F1 opens javadoc view for selected item
  4. Class file
    1. Add jar to the project class path (right click on libraries node, Add Jar/Folder and select any jar)
    2. Unfold contents of the added jar and select any .class file
    • EXPECTED RESULT:Navigator shows members of the class file
  5. Class file - Go to source
    1. Create another project with at least one class
    2. Build the project
    3. Add jar created in dist folder to the classpath of original project
    4. Unfold jar and select any .class file
    5. Double click on any item in Navigator
    • EXPECTED RESULT:Related source file should be opened in editor if available. Caret should be placed over declaration of selected member. If sources are not available, there should be displayed warning in the status bar
  6. Open JavaDoc window
    1. Open navigator.ClassStructure from sample project
    2. Select any item
    3. Click on the "Book" icon in the upper right corner
    • EXPECTED RESULT:Javadoc window is opened (if was not opened before) and show javadoc for selected element. From now on, the content of window is always updated when selecting another node in navigator

Test suite: Inspect Hierarchy

  1. Actual class
    1. Open navigation.SuperClass
    2. Call Hierarchy (Alt-F12)
    • EXPECTED RESULT:Hierarchy view is opened at the right side of editor. It contains hierarchy tree for the class opened in editor. When selecting any of the tree node the navigator is updated. Double click of node (or enter) opens the source file
  2. Selected class
    1. Put cursor at any class identifier in editor (e.g. InputSteam at line 15 of SuperClass)
    2. Press Alt -Shift-F12
    • EXPECTED RESULT:Hierarchy view is updated for the class which is under cursor
  3. Super/Sub hierarchy
    1. Open hierarchy view for SuperClass
    2. Switch from the Supertypes to Subtypes and back
    • EXPECTED RESULT:Supertypes shows recursively all supertypes of the selected class - interfaces and supertypes, Subtypes shows subtypes of the selected class (in this case SubClass1 and SubClass2)
  4. History
    1. Open Hierarchy view for some class
    2. Use the second combobox to inspect history of this view
    • EXPECTED RESULT:The second combobox is populated with class names, which was investigated for hierarchy (from previous test cases there should be at least InputStream and SuperClass). When a class is selected from the list the view is updated
  5. Refresh
    1. Open hierarchy view for SuperClass
    2. In editor put cursor at some another class
    3. Press Refresh for entity under cursor button
    • EXPECTED RESULT:The view is updated with the hierarchy tree for the selected class
  6. Show javadoc
    1. Open hierarchy for some class
    2. Press Open javadoc window button
    • EXPECTED RESULT:The javadoc window is opened and shows javadoc for the selected element (it works same as for navigator window)
  7. Filters
    1. Open hierarchy for SuperClass (switch to supertypes)
    2. Try filter button at the bottom of the view
    3. Right click in the view (not at any class name) and try the items from context menu
    • EXPECTED RESULT:The context menu should contain the same items as the buttons and the bottom. First toggles usage of FQN or simple names in the tree. The second two button control ordering - if the items are ordered alphabetically or in the order they are written in the source files

Test suite: Inspect Members

  1. Actual class
    1. Open any class
    2. Call Navigate -> Inspect -> File Members (CTRL-F12)
    • EXPECTED RESULT:Navigator is opened (if was closed before) and show content of file in editor
  2. Selected Class
    1. Open any class
    2. Put cursor over some another class (e.g. String)
    3. Call Navigate -> Inspect -> Members (CTRL-SHIFT-F12)
    • EXPECTED RESULT:Navigator shows members of the selected class
  3. History
    1. Open Members for another class
    2. Use the second combobox to inspect the history of the view
    • EXPECTED RESULT:The second combobox is populated with names of the classes which were investigated for members. When some item is selected the content is correctly updated.

Test suite: Analyze Stack Window

Purpose: Analyze Stack window, If you want to quickly jump from a stack trace to the corresponding line in the editor.

  1. Show Analyze Stack Window
    1. Invoke Window | Other | Analyze Stack from main menu.
    • EXPECTED RESULT: Analyze Stack Window is opened next to editor area
  2. Jump to line
    1. Open "stacktrace.Run" file
    2. Run the file (code fails with NPE)
    3. Copy NPE from "Output" tab and push "Insert StackTrace From Clipboard" button.
    4. Close the tab containing stacktrace.Rin source and double click the line where NPE was thrown.
    • EXPECTED RESULT:"Run.java" tab is opened and cursor is moved to the line where NPE is thrown.
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