FeaturesPluginsDocs & SupportCommunityPartners

Java Test Specification

Author: Emanuel Hucka
Version: 1.2
Last update: 2005/01/25
Introduction: Java with the Editor module offer full support to work with Java sources and structures. Features in Java module are mostly built on JavaHierarchy. JavaHierarchy is created from Java Model provided by modules JMI and Javacore. Changed sources are reparsed and Java Model is changed after the source files are saved or after parser delay time. Java model content could be checked via JavaHierarchy in explorers (Project or File views) or in Editor navigation toolbar.
Comment:

Table of Contents

Test suite 1: New File Wizard

Purpose: Specifies behavior of New File Wizard for Java Class types.
Setup: Open a project with source packages.

#Test caseDescription
1Create class 1: Choose File Type
  1. Use popup New (select some package in Project view, show popup menu and invoke action New | File/Folder...) or invoke main menu File|New File....
  2. Select Java Classes in Categories tree and select Java Class in File Types list.
  3. Push Next button.
RESULT:Appearance of New Java Class wizard panel (step 2 of New File wizard).
2Create class 2: Object Name and Location
  1. Enter the name of new class into Class Name.
  2. Project field shows new class project's name.
  3. Location list allows to select location of created file in project.
  4. Package list allows to select new class'es package
  5. Created File shows new file's path
  6. Back button should invoke Choose File Type panel. Here you can choose different file type.
  7. Cancel should close this dialog
  8. The Help button serves to invoke help (disabled in this version)
  9. The Finish button creates class from template. This page should check, if the class name is correct.
  10. Press Finish button.
RESULT:New file is created into specified package of selected project and opened in editor window.
3Create package
  1. Use main menu File|New File....
  2. Select Java Classes in Categories tree and select Package in File Types list.
  3. Try to select a project by Project combobox.
  4. Push Next button.
  5. Write new package name into Package Name field.
  6. Push Finish button.
RESULT:New package is created in selected project packages.
4Create package - errors
  1. Use main menu File|New File....
  2. Select Java Classes in Categories tree and select Package in File Types list.
  3. Push Next button.
  4. Write new package name "a/b" into Package Name field.
RESULT:Error message "The Package Name is not valid." is displayed at the bottom of wizard's panel. Finish button is disabled.

Test suite 2: New Java Elements

Purpose: Check creation of fields, methods, classes, interfaces, constructors and initializers.
Setup:

#Test caseDescription
1New Initializer
  1. Create New Initializer using popup. No dialog is invoked, only static Initialzer is inserted.
RESULT:New static initializer is created into a class.
2New Field
  1. Create a field into a class using popup menu Add | Field (invoked on ClassElement) or Add Field (invoked on Fields group). This will invoke Field Customizer.
  2. Set field's properties and create it.
  3. Select the new field in a view and invoke action Open on it.
  4. Try also invalid names (*, a-a etc...) -> You would get some Error (Specified name is not a valid Java identifier).
RESULT:New field is created into the class
3New Constructor
  1. As New Method, but Name, Type, Return Type and Modifiers are disabled.
RESULT:New constructor is created into a class.
4New Method
  1. Create a method into a class using popup menu Add | Method (invoked on ClassElement) or Add Method (invoked on Methods group).
  2. Try to open the new method in source editor (invoke action Open or double click on it in a view).
  3. Try also invalid names (*, if,a-a etc...)
RESULT:New method is created into the class.
5New Inner Elements
  1. Create Inner Class, Interface, Enumeration and Annotation type using popup menu Add | Inner ... (invoked on ClassElement).
  2. Try to check their code by invoking Open action.
  3. Try to create Inner Class in just created Inner Class.
RESULT:New class/interface is created into a class.
6New top-level elements
  1. You can also create classes, interfaces, enumerations and annotation types in existing .java file (not inner ones).
  2. Try to create class Test.
  3. Using popup on java node (Add|Class..) try to create class Test2. Test2 will be created in file Test.java.
RESULT:Test.java is created. There are two top-level classes in it: Test and Test2. Test2 cannot be public.
7Order of elements
  1. Order of java elements in java class node is following:
    1. inner classes, enumerations, annotation types
    2. inner interfaces
    3. group Fields
    4. group Constructors
    5. group Methods
RESULT:Order of java elements.
To test JDK 1.5 specific elements change platform of work project to jdk 1.5 or higher.

Test suite 3: Parser

Purpose: This suite checks, if java hierarchy is correctly updated after modifications.
Setup: Create a new class JavaSourceObject into source packages of an opened project.

#Test caseDescription
1Creating Inner Classes
  1. Write Inner Class into JavaSourceObject class: Open class in Editor and write inner class with at least one method an one field.
  2. Check JavaHierarchy if correspond to source. Examine properties of all made nodes (class, method, field). Make some experiments: change modifiers etc.
  3. Try also make inner class in inner class.
RESULT:New inner class nodes appear in explorer
2Creating Inner Interface
  1. Write Inner Interface do the same as in "Creating Inner Classes".
RESULT:New inner interface nodes appear in explorer
3Create Outer Class in existing .java file
  1. Write new outer class into JavaSourceObject class: Open class in Editor and write new class at the end of the file.
RESULT:New class node appears in explorer.
4Create Outer Interface in existing .java file
  1. Write new outer interface into JavaSourceObject class: Open class in Editor and write outer interface at the end of the file.
RESULT:New interface node appears in explorer
5Creating Constructor
  1. Create constructor into JavaSourceObject class: Open class in Editor and write new constructor with at least one argument.
RESULT:New constructor node appears in explorer.
6Creating Initializer
  1. Create Initializer: add static{} statement to body of class.
RESULT:New initializer appears in Constructors group
7Create new fields and methods
  1. Edit source code of class JavaSourceObject: write method and field. Check if JavaHierarchy is updated correctly. Check your new method by examining properities.
  2. Try to do some changes in source and look if relevant properities are updated: Try to change method's or field's names modifiers, parameters.
  3. Check behavior in nonsense modifiers (e.g. abstract final).
RESULT:New method and field node appears in explorer
To test JDK 1.5 specific elements change platform of work project to jdk 1.5 or higher.

Test suite 4: Override Methods

Purpose: Tests behavior of Override Method feature.
Setup:

#Test caseDescription
1Invoking Override Methods on class
  1. Create a class and invoke action Tools | Override Methods... (or use shortcut Ctrl+I).
  2. Override and Implement Methods dialog will appear. The dialog contains following controls: list of methods and checkboxes Show superclasses and Interfaces, Show Abstract Methods Only, Generate Super Calls and Copy Javadoc.
RESULT:Appearance of Override and Implement Methods dialog.
2Checking Show Superclasses and Interfaces enabled
  1. Enable Show Superclasses and Interfaces checkbox.
  2. Try to disable and enable the Show Abstract Methods Only checkbox.
RESULT:The tree contains classes and interfaces which your class extends. Interfaces have a different icon than classes. Classes and Interfaces have all public and protected methods or only abstract methods as their children. Depends on Show Abstract Methods Only checkbox'es enabling.
3Checking Show Superclasses and Interfaces disabled
  1. Disable the Show Superclasses and Interfaces checkbox.
  2. Try to disable and enable the Show Abstract Methods Only checkbox.
RESULT:The tree contains all public and protected methods or only abstract methods which define super classes or super interfaces of selected class. Depends on Show Abstract Methods Only checkbox'es enabling.
4Commit dialog
  1. Clicking the OK button should close dialog and insert all methods from selected methods list into Your class. Check it.
RESULT:Appearance of Override Methods panel
5Generate Super Calls
  1. Invoke Override and Implementation Methods dialog on some class with 'parents'.
  2. Select a method and enable Generate Super Calls checkbox.
  3. Confirm dialog.
  4. Invoke Override and Implementation Methods dialog on some class with 'parents'.
  5. Select another method and disable Generate Super Calls checkbox.
  6. Confirm dialog.
RESULT:In the both cases selected method will be append to source of the class. Appended method body is empty if Generate Super Calls checkbox is disabled othervise it contains calling of super class method.
6Copy Javadoc
  1. Invoke Override and Implementation Methods dialog on some class with 'parents'.
  2. Select a method and enable Copy Javadoc checkbox.
  3. Confirm dialog.
  4. Invoke Override and Implementation Methods dialog on some class with 'parents'.
  5. Select another method and disable Copy Javadoc checkbox.
  6. Confirm dialog.
RESULT:In the both cases selected method will be appended to source of the class. Appended method body has javadoc from parent's method source if Copy javadoc checkbox is enabled othervise it doesn't have javadoc.

Test suite 5: Fix Imports

Purpose: This suite tests Fix Import tool.
Setup:

#Test caseDescription
1Fix Import Action
  1. The action should be invoked by editor's popum menu (Fix Imports) or by the keybinding Alt+Shift+F (see Tools|Options|Editing|Editor Settings|Java Editor|Key Bindings).
RESULT:Fix Import action is by default bind to Alt+Shift+F kebinding and is listed in editor popup menu.
2Add Import statement
  1. Create a new class.
  2. Write code: Vector v=new Vector(); in a method.
  3. Invoke Fix Import action (Alt+Shif+F).
RESULT:New import statement import java.util.Vector; is appended at import section of code.
3Add Imports - choose package
  1. Use a class from the previous case (java.util.Vector is imported).
  2. Add a code List l=new Vector(); into a method body.
  3. Invoke Fix Import action (Alt+Shif+F).
  4. There appears Fix Imports dialog with a table. In the first column of the table you can found list of Class Names which were found in more than one package. The second column contains lists of their fully qualified names.
  5. Select java.util.List to the List and press the OK button.
RESULT:New import statement import java.util.List; is appended at import section of code.
4Remove Unused Imports
  1. Use a class from the previous case (java.util.List is imported).
  2. Remove a code line List l=new Vector(); from the source file.
  3. Invoke Fix Import action (Alt+Shif+F).
RESULT:Import statement import java.util.List; is remove from the import section of code.

Test suite 6: Synchronization

Purpose: This suite tests Synchronization between interfaces and it's implelemntation
Setup: Unzip a project from sync.zip and open it in IDE.

#Test caseDescription
1Simple synchronization test
  1. Add interface ifaces.RootInterface to an existing class, you can do this by 2 ways: by hand or using PropertySheet.
  2. Invoke Tools|Synchronize action.
  3. In appeared confirmation dialog press the Process All button.
RESULT:Synchronization dialog will appear with all methods from RootInterface. After its confirmation all methods will be added into implementing class.
2Two interfaces
  1. Let your test java class implements 2 interfaces ifaces.RootInterface and ifaces.OtherInterface.
  2. Invoke Tools|Synchronize action.
RESULT:Methods from both interfaces(RootInterface and OtherInterface) should be added into implementing class
3Derived interfaces
  1. Let your test java class implements ifaces.Interface1. Interface1 extends RootInterface.
  2. Invoke Tools|Synchronize action.
RESULT:Methods from both interfaces(RootInterface and Interface1) should be added into implementing class
4Two interfaces extends the same ancestor
  1. Let your test java class implements Interface1 and Interface2. Don't forget to add import ifaces.*; statement.
  2. Invoke Tools|Synchronize action.
RESULT:Methods from both interfaces(Interface1 and Interface2) should be added into implementing class.
5Interface hierarchy has the same ancestor
  1. Let your test java class implements Interface4. Interface4 extends Inteface1 and Interface2.
  2. Invoke Tools|Synchronize action.
RESULT:Methods from Interface4, Interface1 and Interface2 should be added into implementing class
6Mode 'Generate Exception'
  1. Go to Tools | Options | Editing | Java Sources | Source Synchronization. Change Return generation mode to "Generate Exception". Do steps 1.-5.
RESULT:All generated methods should have throw new UnsupportedOperationException(); in it's body
7Mode 'return null'
  1. Go to Tools | Options | Editing | Java Sources | Source Synchronization. Change Return generation mode to "return null". Do steps 1.-5.
RESULT:All generated methods should return 'null' e.g. for int is generated 0, for String is generated null, for boolean is generated false etc.
Auto Synchronization is disabled by default. It can be enabled by options Tools|Options|Editing|Java Sources|Source Synchronization|Synchronization Enabled.

Test suite 7: Property Sheet

Purpose: Checks if source code is correctly parsed and if data are correctly propagated from property sheets to text and vice-versa
Setup:

#Test caseDescription
1Class node
  1. Class has following properties: Modifiers, Name, Type Parameters (read-only), Extends, Implements and Javadoc Comment
  2. Try to change all editable properties (directly or by customizer)
RESULT:Check if changes are propagated to source and vice-versa
2Method node
  1. Method has following properties: Modifiers, Name, Type Parameters (read-only), Parameters, Return Type, Exceptions and Javadoc Comment
  2. Try to change all editable properties (directly or by customizer)
RESULT:Check if changes are propagated to source and vice-versa
3Field node
  1. Field has following properties: Modifiers, Name, Type, Initial Value and Javadoc Comment,
  2. Try to change all editable properties (directly or by customizer)
RESULT:Check if changes are propagated to source and vice-versa.
4Constructor node
  1. Constructor has following properties: Modifiers, Name (disabled), Parameters, Exceptions and Javadoc Comment,
  2. Try to change all editable properties (directly or by customizer)
RESULT:Check if changes are propagated to source and vice-versa.
5Initializer node
  1. Initializer has the only property: Is Static
  2. Change this property
RESULT:Check if changes are propagated to source and vice-versa.
6Interface node
  1. Class has following properties: Modifiers, Name, Type Parameters(read-only), Extends and Javadoc Comment
  2. Try to change all editable properties (directly or by customizer)
RESULT:Check if changes are propagated to source and vice-versa.
To test JDK 1.5 specific nodes change platform of work project to jdk 1.5 or higher.

Test suite 8: Error Annotations

Purpose:
Setup: Open a class from an opened project in editor. Unpack a project from sync.zip.

#Test caseDescription
1Marking an error
  1. Make an error in class definition - put a space between pub and lic ("pub lic")
RESULT:Error annotation appears
2Unmarking an error
  1. Fix the error you made in previous section
RESULT:Error annotation disappears
3Checking error tooltip
  1. Make an error in class definition - put a space between pub and lic ("pub lic")
  2. Check error annotation tooltip.
RESULT:Tooltip text should describe parser error: class or interface expected.
4Unmarking an error after open appropriate project
  1. Make an error in class definition. Change class definition this way:
    public class ColorPreview extends classes.ClassImplements2Interfaces {} 
  2. Error annotation appears: package classes does not exist
  3. Open the Synchronization project (unziped from sync.zip).
  4. Error annotation disappears.
RESULT:Error annotation appears in step 2 and disappears in step 4.
5Options
  1. Change Tools | Options | Editing | Java Sources | Error Annotation Limit to 0
  2. Make an error
RESULT:No error annoatation appears

Test suite 9: JDK 1.5 Java Parser

Purpose: This test suite tries to do some overall testing of the Java parser.
Setup: Download test projects from Javac and Multivalent.

#Test caseDescription
1Parser Test 1.5 on 1.4.2
  1. Set the platform of the project to a JDK 1.5 platform.
  2. Open all Java files in the "Javac" project and verify (wait until it is parsed) that they are all correctly parsed (no error annotations).
  3. Open TBD Java files in the "Multivalent" project and verify (wait until it is parsed) that they are all correctly parsed (no error annotations).
RESULT:No errors should occur during the opening of the project and no error annotations should be in the editor.
2Parser Test 1.4.2 on 1.5
  1. Set the platform of the project to a JDK 1.4.2 platform.
  2. Open all Java files in the "Javac" project and wait until it is parsed.
  3. Open TBD Java files in the "Multivalent" project and wait until it is parsed.
RESULT:No errors should occur during the opening of the project. The error annotations should annotate each usage of JDK1.5 feature.
3Parser Test 1.4.2 on 1.4.2
  1. Set the platform of the project to a JDK 1.4.2 platform.
  2. Open all Java files in the "Javac" project and wait until it is parsed.
  3. Open TBD Java files in the "Multivalent" project and wait until it is parsed.
RESULT:No errors should occur during the opening of the project. The error annotations should annotate each usage of JDK1.5 feature.

Test suite 10: Java Elements Look&Feel

Purpose: This test suite checks if it is possible to change names (UI) of java elements.
Setup:

#Test caseDescription
1Changing class node appearance
  1. Go to Tools | Options | IDE Configuration | Look and Feel | Java Elements
  2. Change Classes property to "klass {n}"
RESULT:Appearance of klass texts in all class nodes in explorer.
2Changing constructor node appearance
  1. Go to Tools | Options | IDE Configuration | Look and Feel | Java Elements
  2. Change Constructors property to "constructor {n}({p,,,","})"
RESULT:Appearance of "constructor" text in constructor nodes in explorer.
3Changing field node appearance
  1. Go to Tools | Options | IDE Configuration | Look and Feel | Java Elements
  2. Change Fields property to "field {n}"
RESULT:Appearance of "field" text in field nodes in explorer.
4Changing initializer node appearance
  1. Go to Tools | Options | IDE Configuration | Look and Feel | Java Elements
  2. Change Initializers property to "init"
RESULT:Appearance of "init" text in all initialziers node in explorer.
5Changing method node appearance
  1. Go to Tools | Options | IDE Configuration | Look and Feel | Java Elements
  2. Change Methods property to "method {n}"
RESULT:Appearance of "method" text in all method nodes in explorer.
6Changing interface node appearance
  1. Go to Tools | Options | IDE Configuration | Look and Feel | Java Elements
  2. Change Interface property to "iface {n}"
RESULT:Appearance of "iface" text in all interface nodes in explorer.
To test JDK 1.5 specific nodes change platform of work project to jdk 1.5 or higher.


Generated: 2005 03 23 02:54
Companion
Projects:
MySQL Database Server   Open JDK: an Open SourceJDK   GlassFish Community: an Open Source Application Server    Mobile & Embedded Community    Open Solaris   java.net - The Source for Java Technology Collaboration   Virtual Box - full virtualizer  Open ESB - The Open Enterprise Service Bus Powered by