TS 70 Java

Java Test Specification for

Author: Jiri Prox
Version: 7.0
Last update: 2009/04/03
Introduction: This document is test specification for Java infrastructure. It covers features related to parsing, analyzing and navigation through the java source files, such as code completion, fix import, Go To type, navigator window, members view, hierarchy view and javadoc view. It also contains basic manipulation with J2se and freeform project. The project prepared for this specification is here, but any project will do for going through this document.
Comments:JavaDoc and Editor Hints are described in their own test specifications.

Contents


Test suite: Syntax Coloring

Purpose: This suite test syntax highlighting.
Setup: Open the test project. Wait till the sources are parsed and indexed (it can took a quite long time, it the IDE was started from the fresh userdir).

  1. Class Members
    1. Open class coloring.Colors from sample project
    2. Check coloring of class members
    • EXPECTED RESULT: Image:members_TS_70_Java.png
  1. Static Members
    1. Open class coloring.Colors2 from sample project
    2. Check coloring of static members
    3. Delete static keyword
    • EXPECTED RESULT: Static members are printed in italics. The the keyword static is removed it is repainted with regular font
  1. Private Unused Members
    1. Open class coloring.ColorsPrivateUnused from sample project
    2. Check colors
    3. Replace modifier private with other modifier and put the change back
    4. Write method which uses private members
    • EXPECTED RESULT: The private unused members are gray underlined. It the member is used or changed to non-private it gets its original color (as shown in previous two testcases)
  1. Method Parameters and Variables
    1. Open class coloring.ColorsParameters from sample project
    2. Check colors
    3. Try to make unused variables and parameters used and vice versa
    • EXPECTED RESULT: Image:parameters_TS_70_Java.png
  1. Unused Imports
    1. Open class coloring.Imports from sample project
    2. Make sure that hints are turned off (Tools -> Options -> Editor -> Hints -> Import -> Unused Import) otherwise the underline color will be yellow - default color for fixable hints
    3. Check colors
    • EXPECTED RESULT: Unused imports are gray underlined
  1. Javadoc Colors
    1. Open class coloring.JavaDoc from sample project
    2. Check colors
    • EXPECTED RESULT: Image:javadoc_TS_70_Java.png
   

Test suite: Normal Code Completion

Purpose: This test suite focus normal code completion (ctrl-space). When completing class name it provides only classes which are imported in current source file. It does not respect expected type of completed element. The code completion is context aware, it means it can provide elements of requested kind (e.g exceptions, packages, interfaces or regular classes, but does not know anything about the type!)
The items of normal code completion are listed in the lower part of code completion popup (under the line) if there are also provided items from smart code completion (see the next test suite).
The shortcut CC widely used in this document stands for Code Completion

  1. Basic Case
    1. Open class completion.Normal from sample project
    2. Inside method test try type following and invoke CC (if not popup automatically):
      1. this.
      2. list.
      3. list.
      4. Thread.
      5. threads[0].
      6. String.
    3. Try several cases by your own.
    • {{result|EXPECTED RESULT:
                   Each time the list of proposed completions is provided. It has the right context and provides only items which are suitable in current position. Check return types of generic types (2nd point in list). Watch also the static and non-static context.
 
  1. Context Aware
    1. Open class completion.NormalContextAware from sample project
    2. add import to the proper place and open CC
    3. add extends to the proper place and open CC
    4. add implements to the proper place and open CC
    5. add throws to the constructor and call CC
    6. add
              try {
      
FileReader fr = new FileReader(new File("")); } catch ( fix imports and call CC behind the last opening brackets
    1. type throw new int method body call CC
    2. Repeat steps 2-7 but before invoking completion type several letters
    • EXPECTED RESULT:

The completion result contain only classes of expected kind, if any prefix was typed all items must match this prefix. Note the CC after implements keyword can contain also regular classes if there is inner interface inside them (example: class Thread contains UncaughExceptionHandler ). At the end of the list there are provided available packages as well.

  1. Anonymous Class
    1. Create new class
    2. In constructor write following code:
       
      
new Runnable() { public void run() { } public void method() { } public int field; }.
    1. Invoke CC after the dot
    • EXPECTED RESULT:
                   Code completion contains method  run() ,  method()  and filed  field , others item are from class  Object 
                
 
  1. Method Finishing
    1. Open class completion.NormalMethods from sample project
    2. Inside testMethod type method
    3. Call CC and select one of the provided items
    • EXPECTED RESULT:
                   The CC provides 4 possible completion, after confirming one of them the text is substituted, the parameter names are copied to code (no parameters matching takes part in this situation) and the parameter tooltip is opened.
                
 
  1. Constructor Finishing
    1. Open class completion.NormalMethods from sample project
    2. Inside testMethod type new NormalMethods
    3. Call CC and select one of the provided constructor
    • EXPECTED RESULT:
                   The CC window providing 5 possible ending is opened, 4 are the for the available constructors and the last one finishes the class name (will have no effect in this situation since the whole name is already entered and there is not other class with such prefix). After selecting item corresponding to constructor it behaves as common method call finishing as shown in previous test case
                
 
  1. Creating Anonymous Class Body
    1. Create new class
    2. It it's constructor type new Comparable
    3. Call code completion and select first item
    • EXPECTED RESULT:
                   The whole class body is added. Check if  compareTo  method has one parameter of type Object.
                
 
  1. Negative Test Cases
    1. Call completion inside string literal
    2. Call completion inside double literal (e.g. 3.3)
    • EXPECTED RESULT: No suggestion is returned
  1. Switch Controled By Enum
    1. Open class completion.NormalSwitch from sample project
    2. in the switch statement type case
    3. call code completion
    • EXPECTED RESULT: CC provides only constants from enum Type
   

Test suite: Smart Code Completion

Purpose: Smart code completion return only items with has (or return) the type suitable in current position. It's invoked by shortcut Ctrl-Space and takes the upper part of code completion popup. Setup:

  1. Assign Statement
    1. Open class completion.SmartAssign from sample project
    2. Type List l = at the end of test method and call smart CC
    3. Replace last entered line with List<String> l = and call smart CC
    4. Replace last entered line with List<String> l = new and call smart CC
    • EXPECTED RESULT: In step 2 the all methods returning List and all fields, parameters and local variables of type List (and assignable types) are returned.
      In step 3 only elements of type List<String> are returned.
      In step 4 all available classes expanding List<String> are provided, if something is selected import is added if necessary
      Note: The type of variable which is being assigned to must be resolved, it means the java.util.List must be imported in this case.
  1. Return Statement
    1. open class completion.SmartReturn from sample project
    2. Replace last line of method getName with return and call smart CC
    3. Replace last line of method getName with return "". and call smart CC
    4. Replace last line of method getName with return new and call smart CC
    • EXPECTED RESULT: In step 2 all elements of type (or returning type) String are listed together with all static methods from class java.lang.String returning String
      In step 3 all methods of java.lang.String returning String are listed
      In step 4 identifier String is inserted, since it was the only possible completion in this situation (String cannot have subclasses it's final)
                
 
  1. Method Parameter
    1. open class completion.SmartParams from sample project
    2. On line 39 call smart CC for each parameter
    • EXPECTED RESULT: Only right items are suggested by CC.
  1. Catch statement
    1. Open class completion.SmartCatch from sample project
    2. Delete Exception from the catch statement and call smart CC on its place
    3. In method of throwingMethod type throw new and call smart CC
    • EXPECTED RESULT: In both cases the exceptions (and their subtypes) which can by thrown by throwingMethod are listed.

  1. Loop
    1. Open class completion.SmartLoop from sample project
    2. Inside method test type following code: for(String s :
    3. Call smart CC
    • EXPECTED RESULT: The smart CC should provide only Collection whose element type is String
  1. Smart Switch
    1. Open class completion.SmartSwitch from sample project
    2. To the switch statement type: case and call smart CC
    3. Change the control variable of switch to i
    • EXPECTED RESULT: In first case the CC returns only enum constants. In the second case it returns all int fields in actual class and static methods from java.lang.Integer returning int.
                
   

Test suite: All Symbols Code Completion

Purpose: All Symbols Code Completion returns all classes with required prefix which are available (in JDK, in current project or additional libraries), even when they are not imported. After selecting item from list an import statement is added if necessary.

            

Setup:

  1. All Classes
    1. Open any class
    2. Add several places call All Symbols CC
    • EXPECTED RESULT: Check if CC provides all available classes matching entered prefix
  1. Switching From Normal to All-Symbols
    1. Create new class
    2. Inside class type JTab and call normal code completion
    • EXPECTED RESULT: The normal CC should not find any matching item so it should be automatically switched to all symbols CC which provide 3 items. Visual difference between normal and all-symbols CC is that the normal CC has footer in the popup window displaying information about others types of completions.
   

Test suite: Keyword Code Completion

Purpose:

               The normal code completion provides also keywords which can be used in current position
            

Setup:

  1. Within Class
    1. Create new class
    2. Delete all its content except package statement
    3. Try to enter whole class with several method, field and inner classes using CC to produce all keywords (only typing identifiers and symbols like brackets and operators by hand)
    • EXPECTED RESULT: The whole class can be written using only CC to insert keywords
  1. Within Annotation
    1. Repeat previous test case, but this time create annotation type
    • EXPECTED RESULT: Annotation type can be created w/o any limitations


Test suite: Code Completion Settings

Purpose: This suite focus on customizing code completion behavior. All options mentioned in following test cases can be found in Tools | Options | Editor | General | Code Completion

            

Setup:

  1. Defaut Values
    1. Open Tools | Options | Editor | General
    2. Check default values in Code Completion section
    • EXPECTED RESULT: Image:CCsettings2_TS_70_Java.png
  1. Auto Popup
    1. Uncheck Auto Popup Completion Window
    2. In any class type this.
    3. Restore the default value and repeat previous step
    • EXPECTED RESULT: The completion window is not opened when pressing '.' if the option is turned off
  1. Automatic Substitution
    1. Uncheck Insert Single Proposals Automatically
    2. In editor type StringBuffe and call normal code completion
    3. In editor type Thread.curren and call normal code completion
    4. Restore the default value and repeat previous two steps
    • EXPECTED RESULT: The CC list provide one item but does not insert it if the options if switched off. Automatic substitution for class names is always turned off.
                
 
  1. Case Sensitive
    1. Check Case Sensitive Code Completion
    2. In editor type string and call normal code completion
    3. type String and call CC
    4. Revert changes in options and repeat step 2
    • EXPECTED RESULT: In step 2 the CC should return no suggestions since there is no such class. The step 3 and step 2 after returning changes should provide String* items

 
  1. Show Deprecated Item
    1. Uncheck Show Deprecated Members in Code Completion
    2. In editor type new Thread().
    3. Return changes and repeat previous step
    • EXPECTED RESULT: If turned off no deprecated members (as susspend() or resume() ) are shown
                
 
  1. Closing Brackets
    1. Uncheck Insert Closing Brackets Automatically
    2. In constructor type
       this( 
    3. In class body type
       int[ 
    4. In class body type
       void method( 
    5. Revert changes and repeat steps 2-4
    • EXPECTED RESULT: Closing bracket in not inserted if option is turned off. The closing bracket of correct type is inserted otherwise, the cursor is located between them.
  1. Documentation popup
    1. Uncheck Auto Popup Documentation Window
    2. Invokde code completion
    • EXPECTED RESULT: The window with javadoc is not poped up any more.
  1. Documentation popup next to Completion
    1. Make sure Auto Popup Documentation Window is on
    2. Check Display Documentation Popup Next to Compleiton
    3. Invokde code completion
    • EXPECTED RESULT: Javadoc window is displayed next (left or right) to the completion window
  1. Guess filled arguments
    1. Switch to java specific settings
    2. Uncheck Guess Filled Method Arguments
    3. Try completing some method call
    4. Check the option again
    5. Try completing some method call
    • EXPECTED RESULT: The the checkbox is checked the code completion will try to match the expected arguments type with variables avaiable in the actual position. E.g. it will replace the name of parameter with actual variable name if the types match. Otherwise it will complete method call using the names of parameters as are written in method declaration.
  1. Autopopup char
    1. Switch to java specific settings
    2. Change char for automatic poping up code completion window
    3. Use several chars - e.g. , and :
    • EXPECTED RESULT: The CC window is not poped up after typing '.' but after typing specified chars
  1. Auto popup on typing
    1. Switch to java specific settings
    2. Check Auto Popup on Typing Any Java Identifier Part
    3. Switch to editor and type any java identifier
    • EXPECTED RESULT: Code completion window is opened every time char is typed
  1. Confirm char
    1. Switch to java specific settings
    2. change Completion Selectors for Java
    3. Open CC window and use all of completion selector
    • EXPECTED RESULT: CC is confirmed (e.g. selected item is inserted into the code) and the selector char is typed
  1. Javadoc popup char
    1. Switch to java specific settings
    2. Writte following text into javadoc comment
      1. @see org.
      2. @
      3. {@
      4. {@link Boolean#
    3. change Auto Popup Triggers for Javadoc
    4. try typing in javadoc
    • EXPECTED RESULT: In all case in step 2 javadoc code completion is opened. In step 4 the changed setting are respected


Test suite: Camel case setting

Purpose: This suite test camel case navigation in java editor Setup:

  1. Jump next/prev
    1. Open java class in editor and type DefaultTableModel s;
    2. Use ctrl-left/right to jump over the declaration
    3. In options disable 'Enable Camel Case Navigation for Java' (Options->Editor->General)
    • EXPECTED RESULT: When options is enabled the cursor jumps also between upper case letter in identifier. If it is of the cursor jump among whole words only.
  1. Delete next/prev
    1. Put cursor in the middle of 'DefaultTableModel'
    2. Use ctrl-delte/backspace
    3. In options toggle 'Enable Camel Case Navigation for Java' (Options->Editor->General)
    • EXPECTED RESULT: The part for current position to next/prev upper case letter is deleted when the option is enabled, the patr to the end/beginning of word is deleted when the option is off.


Test suite: Syntax tree selection

Purpose: This suite test selection of upper/lover node in AST Setup:

  1. Moving to root
    1. Open java class in editor put cursor somewhere in code
    2. Press alt-shift-comma several times
    • EXPECTED RESULT: The selection is enlarge to contain whole parent node in syntax tree -> e.g identifier->method call->block-> method -> class.
  1. Moving to leaf
    1. Just after previous testcase press alt-shift-period
    2. Try to mix this two testcases
    • EXPECTED RESULT: The selection is reduced to lower node in AST. It ends when identifier around original cursor position is selected


Test suite: Parameter ToolTip

Purpose: Parameter tooltip shows expected parameter (types and names) of method call. It highlights actual parameter when moving cursor within method call.

            

Setup:

  1. Method Call
    1. Open class tooltip.ParamToolTip from sample project
    2. In method test type method(|) , the '|' stands for cursor position
    3. Press Ctrl-P
    4. Type 1,1.2
    5. Complete method call by providing all required arguments
    • EXPECTED RESULT: In step 3 the parameter tooltip is shown displaying 3 possible combination of parameters. The list if filtered as typing parameters (when ',' is entered) to contain only valid rows.
  1. Constructor Call
    1. Open class tooltip.ParamToolTip from sample project
    2. In method test type new ParamToolTip(</span>

Test suite: Javadoc

Purpose:
Setup:

  1. Single Window
    1. Open any file
    2. Put caret on any identifier
    3. Invoke Javadoc window (ctrl-shift-space)
    • EXPECTED RESULT: Window providing javadoc for current identifier is opened.
  1. Combined With Proper Completion
    1. Repeat several test cases form suites focused on code completion
    • EXPECTED RESULT: Javadoc window is opened each time CC window displays. It contains right part javadoc.
  1. Javadoc Navigation
    1. Open javadoc window
    2. Try buttons in window header
    3. Try window scrolling
    4. Try to click on hyperlink
    • EXPECTED RESULT: Scrolling using scrollbars or keyboard (shift+arrow key or shift+pgup/pgdown) works. Clicking on hyperlink changes the document. The buttons in window header has this functionality:
    • Navigate to previous page
    • Navigate to next page
    • Open in browser
    • Go To Source
   

Test suite: Matching Method Call Parameters

Purpose:
Setup:

  1. Matching Name
    1. Open <tt> matching.Matching from the sample project
    2. At the last line of test method type method
    3. Finish the method call from CC
    • EXPECTED RESULT: The code is finished with following code: method(name, lastName, aux); . There are variables or fields with the same name and type for the first two parameters, so they are used. For the last parameter there are not any int named number and nearest other int is used (aux in this case)
  1. Matching Name from Supertype
    1. Open matching.Matching from the sample project
    2. At the last line of test method type setSerial
    3. Finish the method call from CC
    • EXPECTED RESULT: The CC inserts setSerial(serial); while serial (field from supertype) is of type int and is close to the name of expected parameter (int SeRiAl)
                
   

Test suite: Go To Navigation

Purpose:
Setup:

  1. Go To Source
    1. Open navigation.GoToSource from the sample project
    2. Put caret on line 30 word String and from contex menu call Navigate | Go To Source
    3. Put caret on line 30 word string and from context menu call Navigate | Go To Source
    4. Put caret on line 31 word string and from main menu call Navigate | Go To Source
    5. Put caret on line 32 word string and from main menu call Navigate | Go To Source
    6. Put caret on line 32 word charAt and press Ctrl_Shift-B
    • {{result|EXPECTED RESULT: In steps 2-5 class java.lang.Sting is opened and cursor is placed at the class header. In step 6 the cursor is placed to the method char chatAt(int)
  1. Go To Source - Missing Source
    1. Create a java class with a class for which you don't have sources opened in projects. (e.g. open editor module, functional tests with jellytools).
    2. Try to click on one of the class names for which you don't have sources opened in projects (e.g. org.netbeans.jemmy.EventTool).
    • EXPECTED RESULT: The go to class action cannot be performed. Verify the error message in status bar. The IDE should beep as well.
  
 
  1. Go To Declaration
    1. Open navigation.GoToSource from the sample project
    2. Put caret on line 30 word String and from context menu call Navigate | Go To Declaration
    3. Put caret on line 31 word string and press Ctrl-B
    • EXPECTED RESULT: In the firs case the class String is opened and cursor is moved to the class declaration. In the second case the cursor is moved to the line 30, where variable string is declared. Try it also with fields, parameters and inner classes.
  
   
  1. Go To Type - Basic Case
    1. Open Go To type dialog (Ctrl-O)
    2. Type several first letters
    3. When searching is done, browse through the list
    4. Select one item from list
    • EXPECTED RESULT: All listed classes fulfill entered criterion. When browsing through list, each item has correct value in Location field. When confirmed the desired source file is opened in editor

   
  1. Go To Type - Wildcard
    1. Open Go To Type dialog
    2. Enter criterion containing wildcards (*, ?)
    • EXPECTED RESULT: Check that all found classes match the criterion
  1. Go To Type - Case Sensitivity
    1. Open Go To Type dialog
    2. Check Case Sensitive checkbox
    3. Type few letters as searching criterion
    • EXPECTED RESULT: Check that all found classes match the criterion respecting case
  1. Go To Type - Negative Case
    1. Open Go To Type dialog
    2. Enter name of non-existing class
    • EXPECTED RESULT: Nothing is found
  1. Go To Type - Capital Letters
    1. Open Go To Type dialog
    2. Enter only capital letters from name of some class (e.g. ATM for AbstractTableModel)
    • EXPECTED RESULT: Desired classes are found
  1. Go To File - basic case
    1. Open Go To File dialog (alt-shift-O)
    2. enter some name of file
    3. use wildcards in the name
    • EXPECTED RESULT: Files matching the pattern are found, project from main project are at the beginning of the list and have different color. After confirmation, the selected file is opened
  1. Go To File - options
    1. Open Go To File dialog (alt-shift-O)
    2. try functionality of each checkbox
    • EXPECTED RESULT: Each checkbox works as expected - the names are selfexplaining
  1. Go To Super Implementation
    1. Create new class and override method toString
    2. put caret in method toString
    3. class Navigate -> Go To Super Implementation from context menu
    • EXPECTED RESULT: Cursor is moved to implementation of the current method in the superclass
  1. Go To Implementation
    1. Create 3 java classes: A, B, C. B extends A, C extends B.
    2. Each of the classes declares "a" method.
    3. Switch to "B" class and click "o" icon in gutter in the line where method "a" is declared (or popup menu - "Navigate | Go To Implementation")
    4. "Overrides/Is Overriden" popup menu is displayed with two items
C <package>

<package>.A
    • EXPECTED RESULT: Choosing first item, the cursor is set to "a" method in "C" class, and choosing second one, the cursor is set to "a" method in "A" class. In a case of "a" method declared in "A" class, "Is Overriden" popup menu is displayed with "B", "C" classes listed


Test suite: Navigator Window

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

            

Setup:

  1. Class Structure
    1. Open navigator.ClassStructure from sample project
    2. Check content of navigator
    • EXPECTED RESULT: Image:navigator-class_TS_70_Java.png
  1. Annotation Structure
    1. Open navigator.AnnotationStructure from sample project
    2. Check content of navigator
    • EXPECTED RESULT: Image:navigator-annotation_TS_70_Java.png
  1. Enum Structure
    1. Open navigator.EnumStructure from sample project
    2. Check content of navigator
    • EXPECTED RESULT: Image:navigator-enum_TS_70_Java.png
  1. 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
    • 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
    • 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
  1. 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
  1. Navigation To Source
    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
  1. Class file
    1. Add jar to the project classpath (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
  1. 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



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.

            

Setup:

  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 "coloring.Colors2" file and following code into its "main" method:
int[] a = null;
int x = a[0];
    1. Run the file (code fails with NPE)
    2. Copy NPE from "Output" tab and push "Insert StackTrace From Clipboard" button.
    3. Close the tab containing Colors2 source and double click the line where NPE was thrown.
    • EXPECTED RESULT: "Colors2" tab is opened and cursor is moved to the line where NPE is thrown.



Test suite: Mark Occurrences

Purpose:
Setup:

  1. Show Usages
    1. Open occurrences.MarkOccurrences from the sample project
    2. Put cursor on name of variable/field/method/parameter (eg. variable on line 40, field on line 31, method on line 33, param on line 33)
    • EXPECTED RESULT: All occurrences of selected element is highlighted in editor and error stripe.
  1. Return Points
    1. Open occurrences.MarkOccurrences from the sample project
    2. Put caret on return type of method at line 33
    3. Put caret on exception in throws clause statement at line 33
    • EXPECTED RESULT: In step 2 all exit point from method are highlighted (4 occurrences). In next step only places where the selected exception is thrown are highlighted (2 occurrences).
  1. Show Usages - Class
    1. Open occurrences.MarkOccurrences from the sample project
    2. Put caret on String at line 31
    • EXPECTED RESULT: All usages of java.lang.String in current class are highlighted
  1. Options - On/Off
    1. Open options and disable Mark Occurrences Of Symbol Under Caret
    2. Go back to editor, put caret on any identifier (method name, class name, field)
    3. Enable MarkOccurrences again
    • EXPECTED RESULT: While MO (Mark Occurrences) is disabled, no occurrences are highlighted.
  1. Mark Occurrences - Types, Methods
    1. Open options and disable Types and Methods
    2. Put caret on line 33 word method or line 31 word String
    3. Enable options again
    • EXPECTED RESULT: Occurrences on lines 31,33, 40 (for class) and 31,44 (for method) are not highlighted when options are disabled
  1. Mark Occurrences - Constant, Fields, Variables
    1. Open options and disable Constants , Fields and Local Variables
    2. Put caret on line 85 word KONST ,on line 31 word field or on line 40 word variable
    3. Enable options again
    • EXPECTED RESULT: No occurrences of actual element is highlighted in step 2
  1. Mark Occurrences - Exceptions, Exit Points
    1. Open options and disable Exceptions Throwing Points
    2. Put caret on line 33 word String
    3. Put caret on line 33 word IOException
    4. Enable the option again and disable Exit Point From Method
    5. Put caret on line 33 word String
    6. Put caret on line 33 word IOException
    7. Enable the option
    • EXPECTED RESULT: In step 2) the editor highlights both exit point from method (return and throw - 4 occurrences). In step 3) occurrences of class IOException are marked (3 occurrences, watch the Keep Marks option). In step 5) all occurrences of String are highlighted (3) and in step 6) 2 places where can be thrown selected exception are marked
  1. Mark Occurrences - Implementing/Overriding methods
    1. Open options and disable Implementing Metohod and Overriding Metohod
    2. Put caret on line 29 word DefaultTableModel or Runnable
    3. Enable the options again and repeat step 2
    • EXPECTED RESULT: When cursor is located over superclass name in extends statement or over implemented interface in implements statement the methods from selected superclass/interface are highlighted. In step 2) this feature is disabled.
  1. Mark Occurrences - Label
    1. Open options and disable Targets of Break and Continue statements
    2. Put caret on words break and continue on lines 63,64 and 65
    3. Enable the option again and repeat step 2)
    • EXPECTED RESULT: When option is ON the label and closing bracket of the related loop is highlighted, e.g. when caret is placed over break on line 74, the label L1 on line 66 and } on line 82 are marked.
  1. Mark Occurrences - Keep marks
    1. Open options and disable Keep Marks
    2. Select several elements, which can be highlighted
    3. Enable the option again and repeat step 2
    • EXPECTED RESULT: When option is disabled the actual mark occurrences marks are discarded when the location of caret is changed, regardless if another highlights are created or not. When enabled, the old marks are removed only in new set of marks is created.
  1. Browsing
    1. Select element which has more occurrences (e.g class String)
    2. Press Alt-Up, Alt-Down
    • EXPECTED RESULT: The caret jumps among the marks


Test suite: Fix Imports

Purpose:
Setup:

  1. Simple Fix Import
    1. Open fiximports.FixImports from the sample project
    2. Delete all import statements
    3. Call Fix Imports (context menu or Ctrl-Shift-I)
    4. Select right classes in comboboxes and confirm
    • EXPECTED RESULT: 3 imports are properly added, one import is marked as <cannot be resolved> in the dialog. Correct the typo from FireReader to FileReader and try it again. All class can be resolved now.
  1. Unresolved Class
    1. Open fiximports.FixImports from the sample project
    2. Add line LoremIpsumDolorSitAmet variable;
    3. Call Fix Import
    • EXPECTED RESULT: The dialog contains <cannot be resolved>
  1. Fast Import
    1. Open fiximports.FixImports from the sample project
    2. Delete all import statements
    3. Put caret on unresolved symbol and press Alt-Shift-I
    4. Select required class from list and confirm by Enter
    • EXPECTED RESULT: Selected class is imported
  1. Fast Import - package
    1. Open fiximports.FixImports from the sample project
    2. Delete all import statements
    3. Put caret on unresolved symbol and press Alt-Shift-I
    4. Select required class from list and confirm by Alt-Enter
    • EXPECTED RESULT: Whole package is imported
  1. Fast Import - FQN
    1. Open fiximports.FixImports from the sample project
    2. Delete all import statements
    3. Put caret on unresolved symbol and press Alt-Shift-I
    4. Select required class from list and confirm by Shift-Enter
    • EXPECTED RESULT: The identifier is replaced with FQN
  1. Fix Import Hint
    1. Open fiximports.FixImports from the sample project
    2. Delete all import statements
    3. At each line with unresolved symbol use hint to add import statement
    • EXPECTED RESULT: All imports are added
  1. Popup
    1. Open new file, type 'File f;'
    2. press Alt-Shift-I
    3. put caret on line with File and press space
    • EXPECTED RESULT: Combobox popup is expanded


Test suite: J2SE Project

Purpose: This suite describes basic project customization. It is focused mainly on changing project classpath and switching source level and java platform
Setup:

  1. Creating
    1. Go to File | New Project
    2. Select General -> JavaApplication and click Next
    3. Specify the project name and location, keep both checkboxes checked and confirm by Finish
    4. Check basic functionality - code completion, fiximports, folding, syntax coloring
    • EXPECTED RESULT: Project is created in given location. It contains class Main and is set as default. All functionality is working fine
  1. Adding Libraries
    1. Open project properties (context menu or menu file)
    2. Select Libraries and Compile tab
    3. Click Add Library and add any library
    • EXPECTED RESULT: After adding the library jars are indexed. Check function as Fix Import, Code Completion, Go To Type (if sources are present) and Smart CC are working for library classes.
  1. Adding Jars
    1. Follow steps in previous test case, but add a simple jar instead of whole library.
    • EXPECTED RESULT: Check function as Fix Import, Code Completion, Go To Type (if sources are present) and Smart CC are working for classes contained in jar.
  1. Adding Folder With Classes
    1. Follow steps in previous test case, but add a folder containing compiled classes
    • EXPECTED RESULT: Check function as Fix Import, Code Completion, Go To Type (if sources are present) and Smart CC are working.
                
 
  1. Dependency on Others Project
    1. Follow steps in previous test case, but add another NB project to the dependencies
    • EXPECTED RESULT: Check if all functionality is working. The Go To source and Javadoc should work for the classes from different project. Test checkbox Compile Project on Classpath
  1. Dependency on Others Project - open project
    1. Unfold Libraries node
    2. Right click on node representing another project
    3. Select Open Project
    • EXPECTED RESULT: The selected project is opened
  1. Building
    1. Build project
    • EXPECTED RESULT: Check if all library jars are copied to dist/libs folder. They can be added as library, NB project or single jar. The folder with classes is not copied to the lib (performance purposes)
                
 
  1. Switching Platform and Source Level
    1. In project properties, Sources tab select different source level and compile.
    2. In project properties, Libraries tab select different java platform and compile project
    • EXPECTED RESULT: In the first step the build will provide jar for desired java version. Test usages of 1.5 features when source level is set to 1.4. Try running jar, compiled for 1.5 to run with JDK1.4
      In the second step the new java platform is indexed (if not used yet) and the features like CC, fiximports etc... works ok. Check range of source levels for new platform.
  1. Properties - panel pre-selection
    1. Expand project node
    2. Right click on Source Packages and select Properties
    3. Right click on Test Packages and select Properties
    4. Right click on Libraries and select Properties
    5. Right click on Test Libraries Packages and select Properties
    • EXPECTED RESULT: In all case properties panel in opened, in 1st two cases the category 'Sources' is selected, in the last two cases the Libraries category is selected
  1. Resolve broken reference
    1. Create new library LIB (can be empty)
    2. Add it to some project
    3. Remove library from the Tools->Libraries
    4. Right click project and Select Resolve References Problem...
    5. Select the line with problem (there should be only one) and click on Reslove
    6. In opened dialog create new library LIB and click OK
    • EXPECTED RESULT: After deleting the library the project name should be written in red color. The 'Resolve References Problem...' opens dialog with problems, missing libraries in our case. After re-creating library and pressing OK the warning sign is replaced by green check and after clicking on close the project name is written in normal color again
  1. Package view
    1. Open project with more complex package structure
    2. Right click on empty place in Project view
    3. Select View Java Packages As -> Tree
    • EXPECTED RESULT: The packages are show as the related folders are store on disk, e.g. as a directory tree, not each package separate on new line. Turn this setting to 'List' again


Test suite: Turning project to shared libraries

Purpose: This suite tests transformation of project to project with sharable libraries
Setup: Prepare several java libraries and jars

  1. Copy Library
    1. Create new project w/o sharable libraries
    2. Add library to its classpath
    3. Open project properties, select Libraries, click on Browse
    4. On 1st page confirm default value
    5. On second page select 'Copy library JAR Files to New Libraries Folder'
    6. Confirm
    • EXPECTED RESULT:The project is successfully transformed, the jars are copied to new location
  1. Keep Library
    1. Create new project w/o sharable libraries
    2. Add library to its classpath
    3. Open project properties, select Libraries, click on Browse
    4. On 1st page confirm default value
    5. On second page select each of values 'Use Relative Path to JAR File' and 'Use Absolute Path to JAR File'
    6. Confirm
    • EXPECTED RESULT:The project is successfully transformed, the jars are not copied to new location, check config file in shared libraries folder that the paths are resolved correctly
  1. Copy JAR
    1. Create new project w/o sharable libraries
    2. Add jar to its classpath
    3. Open project properties, select Libraries, click on Browse
    4. On 1st page confirm default value
    5. On second page select 'Copy JAR/Folder to New Libraries Folder'
    6. Confirm
    • EXPECTED RESULT:The project is successfully transformed, the jars are copied to new location
  1. Keep jars
    1. Create new project w/o sharable libraries
    2. Add jars to its classpath
    3. Open project properties, select Libraries, click on Browse
    4. On 1st page confirm default value
    5. On second page select each of values 'Use Relative Path to JAR/Folder' and 'Use Absolute Path to JAR/Folder'
    6. Confirm
    • EXPECTED RESULT:The project is successfully transformed, the jars are not copied to new location, check config file in shared libraries folder that the paths are resolved correctly



Test suite: Members View

Purpose:
Setup:

  1. Members of actual class
    1. Put focus in editor and press ctrl-F12
    2. Inspect opened dialog
    • EXPECTED RESULT: The dialog Members is opened. In the left part there is tree reflecting class members. In the righr there is javadoc for selected element. Image:members-view_TS_70_Java.png


  1. Members of class under cursor
    1. Put caret over Integer identifier
    2. Press ctrl-shift-F12
    • EXPECTED RESULT: The Members view shows members of class Integer
  1. Filters - Button
    1. Open Members View for class SuperClass
    2. Try functionality for each filter button in the bottom part of dialog
    3. Check persistence of filter buttons state between dialog invocation
    • EXPECTED RESULT: Each button controls displaying specific types of elements. For more info check the button tooltip. State of each button is preserved between dialog invocation.
                
 
  1. Text Filter
    1. Invoke Members View dialog
    2. Type several character in the filter textfield (upper part of dialog)
    3. Repeat steps 2) while Case Sensitive checkbox is checked
    • EXPECTED RESULT: The elements in tree are filtered to containg only matching items and the nodes corresponding to classes and interfaces
                
 
  1. Members - navigation
    1. Open Members View dialog
    2. Double click on any item
    3. Repeat step 2) for several items of different type
    • EXPECTED RESULT: The source file is opened and caret is located on declaration of selected item
   

Test suite: Hierarchy View

Purpose:
Setup:

  1. Actual class hierarchy
    1. Put focus in editor and press alt-F12
    2. Inspect opened dialog
    • EXPECTED RESULT: The dialog Hierarchy is opened. In the left part there is tree reflecting the class hierarchy. In the right there is javadoc for selected element. Image:hierarchy-view_TS_70_Java.png
  1. Hierarchy of selected class
    1. open navigation.SuperClass
    2. Put caret over identifier Integer
    3. Press alt-shift-F12
    • EXPECTED RESULT: Hierarchy dialog is opened for class java.lang.Integer
  1. Hierarchy - filter buttons
    1. Open hierarchy view for for class SuperClass
    2. Try toggedle each filter button in the lower part of the dialog
    • EXPECTED RESULT: The buttons have following functions (from left to right):
    • Show super type hierarchy - the hierarchy tree contains only superclasses and implemented interfaces. For each of them its superclass/implemented interfaces are listed as well
    • Show subtype hierarchy - all subclasses are listed, plus the superclasses of curren class.
    • Show fully qualified names - the items in tree are identified by FQNs
    • Show inner classes and interfaces - the hierarchy tree shows ale the inner classes and intefaces
    • Expand All - expands whole tree
                
 
  1. Hierarchy filter
    1. Open Hierarchy View for any class
    2. Type several letters to filter textfield (upper part of the dialog)
    3. Repeat step 2) with enabled Case sensitive checkbox
    • EXPECTED RESULT: The first matching item is selected
  1. Hierarchy - navigation
    1. Open Hierarchy View for any class
    2. Double click on item from hierarchy tree
    3. Repeat step 2) from different items
    • EXPECTED RESULT: The related source file is opened and cartet is located over declaration of selected element
                
   

Test suite: Declaration View

Purpose:
Setup:

  1. Declaration - Basic Case
    1. Open navigation.Declaration
    2. Open Declaration Window (Window | Other | Declaration View)
    3. Put caret on each identified used in this class
    • EXPECTED RESULT: The right declaration is shown for each type of element
  1. Declaration - Library
    1. Add library containig classes and sources to the project
    2. Test Declaration View on classes and others elements from the library
    • EXPECTED RESULT: Declaration window show correct code


Test suite: Javadoc View

Purpose:
Setup:

  1. JavaDoc - Basic Case
    1. Open navigation.JavaDoc
    2. Open Declaration Window (Window | Other | Declaration View)
    3. Put caret on every identifier in method test()
    • EXPECTED RESULT: Javadoc Window shows javadoc for selected element if avaiable
  1. Javadoc - Library
    1. Add library contating classes and javadoc to the project
    2. Check javadoc for elements from library
    • EXPECTED RESULT: Javadoc window show correct text


Test suite: J2SE project

Purpose:
Setup:

  1. Creating project
    1. Create new J2se project from menu (File -> New Project)
    • EXPECTED RESULT: Project is created, main class is generated. Project is compilable and all features (goto type, code completion) works fine.
  1. Adding libraries
    1. Open project properties and select node Libraries
    2. In tab "Compile" press add Library and select some class library
    • EXPECTED RESULT: Library classes are added to project classpath (check by code completion and building project). If library has assigned sources Go To Declaration works for library classes. If the library contains javadoc Javadoc Index Search work as well. (Code completion javadoc depends on sources - it generated directly from comments)
  1. Adding libraries - another way
    1. Open project properties and select node Libraries
    2. In tab "Compile" use add Jar/Folder and and Project
    • EXPECTED RESULT: Classes from jar/folder and from project's output jar are added as in previous case
  1. Adding libraries - building
    1. Build project with added several types of libraries
    • EXPECTED RESULT: Required jars are moved to dist/lib (it have to be JavaApplication not Java Library project and whole folder should not be added in Libraries tab)
  1. Removing libraries
    1. Remove libraries added in previous cases, one by one
    2. Verify project class path after each remove
    • EXPECTED RESULT: The classes from removed libraries are not in classpath any more. It can be verified in code completion and by broken build is library class is used somewhere in the project
  1. Adding source root
    1. Open project properties and select node Sources
    2. Press Add folder in Source packages folder and select some folder with java files (it must not be owned by another project)
    3. Remove the source folder again
    • EXPECTED RESULT: When root is added the java files (and other files) are visible in the project view, the java files are added to classpath (can be verified by code completion). After remove, the java files are not in classpath anymore


Test suite: FreeForm project

Purpose:
Setup:

  1. Creating freeform project
    1. Unzip attached archive
    2. File -> New Project, select Java Free form project
    3. On next page enter the path to the extracted archive in the Location textfield, the others textfields should be filled automatically
    4. On next page the 3 ant targets should be prefilled in appropriate textfields (compile, clean, test), keep the defaults
    5. On next page add 'source' subfolder to Source Package Folders and 'test' subfolder as Test Package Folder, continue on next page
    6. Add CoreLib.jar from libs subfolder to source classpath, and JUnit from the same folder to the classpath for tests
    7. Press Finish
    • EXPECTED RESULT: Project is created, there are no compilations error, project can be build


Test suite: Sample java project

Purpose:
Setup:

  1. Sample project
    1. Create all java sample project
    • EXPECTED RESULT: All projects can be created and compiled w/o any problems


Test suite: Node tooltips

Purpose:
Setup:

  1. Contains main method
    1. Create class with main method
    • EXPECTED RESULT: Node in project wiev has green arrow badge, the tooltip says 'Contain main class'
  1. Need recompilation
    1. Make sure Compile on save is disabled
    2. Edit some file and save it
    3. Compile edited file
    • EXPECTED RESULT: When file is edited the out-of-data icon (wrench) is displayed and tooltip contains 'Needs to be compiled'. After compilation the badge and tooltip go away
  1. Error badge
    1. Make an error in the class and save it
    2. Correct the error
    • EXPECTED RESULT: The class containing the error is marked with the error badge, the badge is propagated to package, source root and project. The tooltis says 'Error parsing file' for file, and 'Contains files with error' for the other nodes. Once the error is corrected the badges disappears


Test suite: Support for annotation processors in the editor

Purpose: There is a new feature on the libraries allowing to add annotation processors to your project (besides putting them directly into the classpath) For this purpose there will be used "lombok" project
Setup: download "lombok.jar" [1] and put into "Processor" (Project Properties | Libraries) and "Compile" tabs. Make sure all check boxes for annotation processing are checked - Project Properties | Build | Compiling | Enable Annotation Processing and Enable Annotations Processing in Editor.

  1. Property options
    1. Select project root of desired java application project and invoke "Properties" popup menu from within "Projects" view.
    2. Choose "Libraries" category. There should be "Processor" tab between "Compile" and "Run" tabs.
    3. Now switch to "Build | Compiling" category.
    • EXPECTED RESULT: There should be "Enable Annotation Processing" and "Enable Annotation Processing in Editor" checkboxes, "Annotation Processors" list with "Add" and "Remove". "Annotation Options" list with "Add" and "Remove" button.


  1. Annotation processor and Code completion
    1. Create new java file.
    2. Enter new property: "private final int i;"
    3. Add annotation "@Data" before "class".
    4. Add annotation "@Getter" before "private ..." class field.
    5. There should be error reported. Add all necessary imports.
    6. Create new method "private void method() { | };" Put the cursor to the position of "|" character in the method. Invoke Code Completion}
    • EXPECTED RESULT: There should be listed "getI()" method. After confirming the getter method it has to be written into the "method" body. Source code has to be compilable.


  1. Annotation processor in action
    1. Create new java file.
    2. Enter new property: "private final int i;"
    3. Add annotation "@Data" before "class".
    4. Add annotation "@Getter" before "private ..." class field.
    5. There should be error reported. Add all necessary imports.
    • EXPECTED RESULT: After resolving all imports, then "Navigator" window there should be getter for "i", constructor with "i" field initialization. Experiment with other annotations, make sure project is compilable.


Test suite: Miscellaneous

Purpose: This test minor features

  1. Add semicolon
    1. Open java file
    2. On non-empty line press ctrl-;
    3. On non-empty line press ctrl-shift-;
    • EXPECTED RESULT: The ';' is added to the end of line, in the second case the cursor is also moved to next line




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