TS 65 FormSanity

Form Editor - Sanity Test Specification

Author: Pavel Pribyl
Version: 7.0
Lastupdate: 2008/06/29
Introduction: Test specification for Form module. It should cover all key features of the Form editor. Estimated duration: 4 hours

Contents

Test suite: Creating of Form files

Purpose: Test verifies basic aspects of Form files creation
Expected time: 10 - 15 minutes
Setup: Start IDE with clear userdir. Create new Java project (called e.g. "MyProject") with default settings.

  1. Create a GUI container using project content menu
    1. In the Projects window, right-click the 'MyProject' node and choose New > JFrame Form.
    2. Type "MyJFrame" for Class Name and select 'myproject' from the Package combobox. Leave other settings unchanged.
    3. Push Finish button
    • EXPECTED RESULT: The IDE creates new 'MyJFrame.java' file and opens it in the Editor (Design mode). New windows are opened - Palette, Properties and Inspector.
  2. Create a GUI container using package content menu
    1. In the Projects window, right-click the 'myproject' node and choose New > Other ... > Java Swing GUI Forms - JDialog Form.
    2. Type "MyDialog" for Class Name and verify, that 'myproject' is selected in the Package combobox. Leave other settings unchanged.
    3. Push Finish button
    • EXPECTED RESULT: The IDE creates new 'MyDialog.java' file. Editor should look exactly the same as in testcase 1
  3. Create a GUI container using toolbar icon
    1. In the Projects window, select the 'myproject' (package) node and click the 'New File' icon http://wiki.netbeans.org/attach/TS_65_FormSanity/newFile_TS_65_FormSanity.png in the IDE's toolbar
    2. Choose Java Swing GUI Forms - JInternalFrame Form
    3. Type "MyInternalFrame" for Class Name and verify, that 'myproject' is selected in the Package combobox. Leave other settings unchanged.
    4. Push Finish button
    • EXPECTED RESULT: The IDE creates new 'MyInternalFrame.java' file. Editor should look exactly the same as in testcase 1 and 2
  4. Create a GUI container using main menu
    1. In the Projects window, select the 'MyProject' node and invoke File - New File ...
    2. Choose Java Swing GUI Forms - JPanel Form
    3. Type "MyPanel" for Class Name and type "anotherPackage" for the Package name. Leave other settings unchanged.
    4. Push Finish button
    • EXPECTED RESULT: File 'MyPanel.java' is created properly and opened in Editor. It is situated in new package called 'anotherPackage'
  5. Create remaining GUI containers
    1. Create following Swing GUI components (use any of the previous approaches)
    • JApplet Form
    • Application Sample Form
    • MDI Application Sample Form
    • OK / Cancel Dialog Sample Form
    1. Create following AWT GUI components (new file from 'AWT GUI Forms' Category)
    • Applet Form
    • Dialog Form
    • Frame Form
    • Panel Form
    1. Clean&Build the project with all the files, created in this and previous testcases.
    • EXPECTED RESULT: All files should be created properly and opened in the Editor. Cleaning and building the project runs smoothly, without any error reported.
  1. Valid name verification
    1. In the Projects window, right-click the 'myproject' node and choose New > JFrame Form
    2. Delete any text in the Class name textfield
    • Verify that blue info icon appears with text 'Provide valid Java Class Name' and Finish button is disabled
    1. Try typing a name starting with number, containing illegal characters (!@#$%^&*) etc.
    • Verify that red error icon appears with text 'The Class Name is not valid' and Finish button is disabled
    1. Type a Class name, that already exists (e.g. 'MyJFrame')
    • Verify that red error icon appears with text 'The file MyJFrame.java already exists' and Finish button is disabled
    1. Push Cancel button
    • EXPECTED RESULT: It is impossible to create Form file with invalid name


Test suite: Visual development

Purpose: Test verifies functionality of GUI builder, manipulating with components and visual feedback
Expected time: approx. 45 minutes
Setup: Continue from the previous test suite

  1. Adding component from the Pallete to top-level container
    1. In the Projects window double-click 'MyJFrame.java' from the 'myproject' package
    • Editor window should open in the Design mode
    1. In the Palette window, select the JPanel component from 'Swing Containers' category, by clicking (and releasing) the mouse button
    2. Move the mouse into the form in the GUI builder. As you move the mouse towards the edges of the form, blue dashed guidelines should appear.
    • Verify that the guidelines appear and that Assistant (white stripe with a light bulb at the top side of the editor) displays correct information about snapping/aligning
    1. Place the JPanel to the upper left corner of the form by clicking the mouse button
    • EXPECTED RESULT: JPanel is placed inside the form. It's name and icon appears in Inspector window as a sub-node of JFrame node. It is also selected in the Properties window.
  1. Modifying the component in Editor
    1. Click on the JPanel in the form to select it (note that the JPanel is not visible until selected or until you hover the mouse over it). Resize handlers should appear.
    2. Resize the JPanel by dragging one on the resize handlers
    • Verify that resizing works and guidelines appear as you move close to the edges of the form
    1. Move the JPanel by clicking inside it, holding the mouse button and moving the mouse
    2. Release the mouse button in desired position
    3. Move the JPanel again, now try to place it outside the form
    • JPanel disappears from the form, jPanel node in the Inspector window moves from JFrame to Other Components
    1. Undo the last action (using the toolbar icon, keyboard shortcut or menu option)
    • JPanel reappears in its original position in the form, jPanel node moves back from Other Components
    • EXPECTED RESULT: The JPanel can be resized and moved without problems. Snapping to guidelines and form edges works.
  1. Adding another components into Swing container
    1. In the Palette window, click on JButton component from 'Swing Controls' category
    2. Place some JButtons into the JPanel by holding down the Shift key and clicking to desired locations
    3. Add another components from 'Swing Controls', either into the JPanel or into the top-level container (form).
    • Ensure that components are placed properly, can be aligned/snapped to each other.
    • Inspector window should reflect actual component hierarchy - components placed into JPanel should be displayed as a subnode of jPanel node
    • EXPECTED RESULT: Components are placed correctly. The Inspector window displays the component hierarchy
  1. In-place editing
    1. Select any of the JButtons placed into form in previous testcase
    2. Press SPACE
    3. Type some text and press Enter
    • Verify that the text of the JButton is changed correctly
    1. Repeat previous steps, but instead of pressing Enter, click outside the edited JButton
    • The text of the JButton should be changed too
    1. Try in-place editing on other components with a text label: JLabel, JCheckBox, JRadioButton and JToggleButton
    • EXPECTED RESULT: Custom text is set properly.
  1. Handling multiple components
    1. Select any of the components placed inside the JPanel
    2. Hold the Ctrl key and click on another component from the JPanel
    3. Hold the Shift key and click on another component from the JPanel
    • Verify that all three components are selected (highlighted with orange border) and resize handlers are NOT shown
    1. Click on one of the selected components, hold down the mouse button and move the whole group to another place in the JPanel
    2. Place the group outside the JPanel
    • Ensure that Inspector window is updated (those three components become subnodes of JFrame)
    • Note: If selected components are located in different containers, moving is NOT possible
    1. Undo previous action
    • All three components should return to their original position in the JPanel
    1. Click anywhere into the form and hold the mouse button
    2. Drag a rectangular selection area over some components of the form
    3. Release the mouse button
    • Verify that all components located inside the selection area are selected
    1. Hold down the Shift key and select multiple components from the JPanel
    • All components inside the selection area are selected
    • EXPECTED RESULT: All methods of selecting multiple components work correctly. All selected components can be moved at once by drag&drop, in case they are located in the same container.
  1. Adding another component using drag&drop
    1. In the Palette window, click and hold the mouse button on the Scroll Pane (JScrollPane) component from 'Swing Containers' category
    2. With the mouse button still pressed, drag the Scroll Pane to the form and place it next to the Panel by releasing the mouse button.
    • The JPanel itself is not visible, but the guidelines should appear as you move towards it
    • EXPECTED RESULT: JScrollPane is placed in the form, next to the JPanel from previous testcase. It appears on the same level in the Inspector window. Properties window change and display properties of the JScrollPane
  1. Moving a container to another one
    1. Move the JPanel over the JScrollPane and keep holding the mouse button
    2. Once the mouse cursor is over the JScrollPane, the JScrloPane's border should be highlighted by orange dashed line
    3. Release the mouse button
    • EXPECTED RESULT: JPanel is placed into JScrollPane. It is displayed in the Inspector window as its subnode. In case the JPanel was larger than the JScrollPane, scrollbars are visible.The scrollbars are not functional in the editing mode
  2. Designing container/parent
    1. Double click on the scrollbars of the JScrollPane in the editor
    • Result: Only the JSrollPane and its content is displayed
    1. Double click on the JPanel inside the JScrollPane
    • Result: Only the JPanel and its content is displayed
    • NOTE: You have to click exactly on the JPanel's area, not on any of the components. If you accidentaly double click on any of the components, the source code will be displayed. In that case, switch back to the 'Design' view
    1. Double click on the JPanel again
    • EXPECTED RESULT: The original form is displayed. No component is changed.
  1. Adding Menus
    1. Select 'Menu Bar' (JMenuBar) from the Palette window and place it into the form
    2. Drag a 'Menu' (JMenu) from the Palette into the JMenuBar
    3. Click on the newly added JMenu, press SPACE and change the text to "MyMenu"
    4. Click on a 'Menu Item' (JMenuItem) in the Palette and then click on 'MyMenu' in the form
    5. Repeat previous step with 'Menu Item / Radio Button', 'Menu Item / CheckBox' and 'Separator'
    6. Use Shift-click to add more elements at once
    7. Use in-line editing (pressing SPACE when menu item is selected) to set custom text
    8. Change the order of menu items in 'MyMenu' by draging them with mouse up or down
    • EXPECTED RESULT: New menu bar is located at the top of the form with those menus: 'File', 'Edit' and 'MyMenu'. MyMenu contains all added components.
  2. Adding components from Projects window
    1. Create new Bean in 'myproject' package by invoking 'New > Other... > Swing GUI Forms - Bean Form' from the myproject's content menu
    2. Type "MyBeanButton" for a Class Name and press Next
    3. Type "javax.swing.JButton" for a Superclass and press Finish button
    4. Edit the text of the newly created button to "Press me!"
    5. Save the file and compile it
    • Note: File must be compiled "manually" (e.g. by pressing F9 or selecting the compile option from the menu), even if the 'Compile on Save' is turned on
    1. Switch back to the original form
    2. Drag the 'MyBeanButton.java' node from the Projects window to the form in the editor
    • EXPECTED RESULT: Button with text "Press me!" is placed in the form
  1. Adding components from the Files view
    1. Create new JPanel Form in 'myproject' package and name it e.g. "MyPanel2"
    2. Add some containers (e.g. Scroll Pane, Tabbed Pane etc.) and Swing components (JButton, jRadioButton, JSeparator etc.) into it
    3. Save and compile the file
    4. Switch back to the original form
    5. Switch from Projects to Files window
    6. Drag the 'MyPanel2.java' node from the Files window to the form in the editor
    • EXPECTED RESULT: The panel is placed in the form. All components (added in step 2) are present, with proper design and layout.
  2. Preview Design
    1. Click on the 'Preview Design' icon in the Editor's toolbar
    • EXPECTED RESULT: New window with preview of the form is opened. The layout of components is the same as in the design area. All components are functional (scroll bars are active, chceckboxes can be checked, nodes of a JTree can be expanded, etc.)
  3. Preview Design with different Look and Feel
    1. Invoke popup menu of the form (JFrame)
    2. Select 'Preview design >'
    3. Try selecting different values from the menu and check the results
    • NOTE: issue 166092
    • EXPECTED RESULT: New window with preview of the form with selected Look and Feel is opened . The layout of components is the same as in the design area. All components are functional.


Test suite: Other features of the GUI builder

Purpose: Test verifies functionality of advanced actions of the GUI editor, interaction between components and different layout setting
Expected time: approx. 30 minutes
Setup: Start IDE with clear userdir. Create new Java project (called e.g. "MyProject2") with default settings. Create new JFrame Form and name it e.g. "MyJFrame"

  1. Copy and paste
    1. Insert new JPanel into the form and add JButton into this JPanel
    2. Set custom text to the button (e.g. "Press me!")
    3. Invoke the popup menu of the JButton and select 'Copy'
    4. Click anywhere into the JPanel and select 'Paste' from the popup menu
    5. Paste the JButton to the form outside the JPanel using popup menu
    6. Paste the JButton outside form (to the blank space) using popup menu
    • Verify that exact copies of the JButton are created. Check their position in the Inspector window. The node od the JButton placed outside the form should be situated under the 'Other Components'
    1. Repeat previous steps using the menu options 'Edit-Copy' and 'Edit-Paste'
    2. Repeat previous steps using keyboard shortcuts
    • Copies are created in desired locations in the form. It is NOT possible to paste it into the blank area this way
    1. Select the JPanel (it should not be empty now) and perform Copy & Paste
    2. Select multiple components at once and perform Copy & Paste
    • EXPECTED RESULT: The selected component(s) are always copied correctly into desired location. Container is copied with its content, it is possible to create copy of multiple selected items. All the operations are undo-able
  1. Delete
    1. Delete some components from the form, using following methods:
    • Hit the Delete key
    • Invoke 'Delete' from the popup menu of the component
    • Select Edit - Delete from the IDE menu
    1. Use the same methods to delete multiple selected items
    2. Use Undo and Redo actions
    • EXPECTED RESULT: All methods works properly. Deleting a container erases all its components as well. Deleting multiple selected items erases them all.
      Undoing delete action returns the deleted item to its original position. Redo action deletes it again.
  1. Duplicate
    1. Select some component and invoke 'Duplicate' from the popup menu
    2. Duplicate multiple selected items
    3. Duplicate a container with some components inside
    • EXPECTED RESULT: The action creates exact copy of duplicated component(s)
  2. Adding components using popup menu
    1. Invoke a popup menu of the form (JFrame) and select 'Add From Palette >'
    2. Try adding some components from different categories
    3. Add components to some container (e.g. JPanel) using the same approach
    4. Try adding components to inappropriate containers (e.g. JMenuBar to JPanel, JMenuItem to JFrame etc.)
    • EXPECTED RESULT: Components can be placed only into appropriate container. Nothing happens if the component cannot be added to container (no error/warning message is displayed)
  3. Alignment of components
    1. Create new JFrame Form, name it e.g. "MyJFrame2"
    2. Place JButton near the upper border of the form
    3. Place JLabel into the middle part of the form
    4. Place JProgressBar near the bottom border of the form
    5. Select all three components and subsequently press first three alignment buttons from the Editor's toolbar http://wiki.netbeans.org/attach/TS_61_visualdevelopment/AlignmentTools.png
      ("Align left in column", "Align right in column", "Center horizontally")
    • Verify, that all three components are aligned to the left and right (according to the widest item, in this case the JProgressBar) and to the center
    1. Place JPanel next to the JButton and select them both
    2. Press the remaining buttons for vertical alignment from the toolbar
      ("Align to top in row", "Align to bottom in row", "Center vertically")
    • Verify, that the JButton aligns with the top/bottom/center of the JPanel as you press the buttons
    1. Repeat previous steps using 'Align >' options from the popup menu of selected components
    • EXPECTED RESULT: All items are aligned accordingly
    • Teardown: Delete all components from the form
  1. Anchors
    1. Place JButton near the upper left corner of the form
    2. Place another JButton near the bottom left corner
    • Verify, that anchors are drawn properly (blue dotted lines with "knobs" attached to the edges of the form)
    • In the case of the first JButton they should be connected to top and left edge, while the other one has its anchors connected to bottom and left edge
    1. Open the 'Preview Design' window
    2. Resize the newly opened window vertically by dragging the bottom edge up and/or down
    • Only the bottom JButton is moving
    1. Close the preview window
    2. Open the popup menu of the upper JButton, select the 'Anchor >' and check 'Bottom'
    3. Try running the form file (for example right click on the form's node in Project window ('MyJFrame2.java') and select 'Run File')
    4. Resize the newly opened window by dragging the bottom edge again.
    • In this case, both button should move as their anchors are attached to the bottom
    1. Close the window with the form
    2. Try changing 'Left' for 'Right' in the 'Anchor' menu and verify the result in the Preview and during the runtime
    • EXPECTED RESULT: Buttons are moved if the form window is resized in the direction they have anchors attached to.
    • Teardown: Delete all components from the form
  1. Risizability of components
    1. Place a JTabbedPane into the form
    2. Push both buttons for setting item's resizability in the Editor toolbar (two rightmost buttons with arrows)
    3. Invoke the JTabbedPane's popup menu, select 'Auto Resizing >' and uncheck (disable) both values : 'Horizontal' and 'Vertical'
    4. Check (enable) them again
    • Four anchors should be visible
    • Verify that icons in the toolbar are enabled/disabled accordingly to menu options change
    1. Place a JPanel inside the JTabbedPane
    2. Place a JButton inside the JPanel
    3. Select the JPanel and turn on its horizontal resizability
    4. Open 'Preview Design' and resize the window both horizontally and vertically
    • EXPECTED RESULT: JTabbedPane changes its size in all direction, while the JButton resizes only horizontally
  1. Absolute layout
    1. Add four more JButtons into the JPanel from previous testcase (resize the whole JTabbedPane if necessary)
    2. Invoke the popup menu of the JPanel and select 'Set Layout >'
    3. Change to 'Absolute Layout'
    • EXPECTED RESULT: All JButtons are moved to the top lef corner of the JPanel. They can overlap each other. The JButtons can be placed almost freely (they snap to invisible grid). No anchors are used in this layout.
  2. Border layout
    1. Change to 'Border layout' using the JPanel's popup menu
    2. In the Inspector window select the 'BorderLayout' node and invoke its popup menu
    3. Select 'Properties'
    4. Set both values to 10
    • EXPECTED RESULT: Each JButtons is placed to another area. Spaces between the areas correspond to the values set.
  3. BoxLayout
    1. Change to 'Box Layout' using the JPanel's popup menu
    2. Edit layout properties from the Inspector window
    3. Try changing the axis value (check the result for all values)
    • EXPECTED RESULT: All JButtons are aligned into a row ('Line axis' and 'X axis' values) or column ('Page axis' and 'Y axis')
  4. Card Layout
    1. Change to 'Card Layout' using the JPanel's popup menu
    2. Edit layout properties from the Inspector window
    3. Set both values to 10
    • EXPECTED RESULT: JButtons placed into the center of the JPanel (only one Button is visible, others are below). The size of gap corresponds with the values set
  5. Flow Layout
    1. Change to 'Flow Layout' using the JPanel's popup menu
    2. Edit layout properties from the Inspector window
    3. Try modifying the setting and check the results
    • EXPECTED RESULT: JButtons in a row and aligned either to the left, right, or center. The size of gap between components corresponds with the values set
  6. Grid Bag Layout
    1. Change to 'Grid Bag Layout' using the JPanel's popup menu
    2. In the Inspector window select the 'GridBagLayout' node and invoke its popup menu
    3. Select 'Customize'
    4. In the new Customizer window, drag the JButtons to different positions (a grid should display once a Button is moved to a new position)
    5. Select different values for Anchor, Insets, Fill, I-Padding and Grid size for each JButton
    6. Close the Customizer
    • EXPECTED RESULT: Position of JButtons in JPanel corresponds with the design, created in GridBagCustomizer
  7. Grid Layout
    1. Change to 'Grid Layout' using the JPanel's popup menu
    2. Edit layout properties from the Inspector window
    3. Set Columns:2, Horizontal Gap: 10, Rows:3, Vertical Gap:20
    • EXPECTED RESULT: JButtons are arranged into 3 rows and two columns. The size of gap between components corresponds with the values set
  8. Null Layout
    1. Change to 'Null Layout' using the JPanel's popup menu
    • EXPECTED RESULT: JButtons the same way as they were in previous layout. They can be moved to another position


Test suite: Inspector window

Purpose: Test verifies, that changes made in the Component Inspector are reflected in Form editor, Properties editor and vice versa. It also verifies, that correct code is generated
Expected time: 15 minutes
Setup: Create new empty JFrame Form in the project from previous test suite.

  1. Inserting components
    1. In the Inspector window select the JFrame node and invoke its popup menu
    2. Select 'Add From Pallete > Swing Containers > Tabbed Pane'
    3. Select newly added 'jTabbedPane1' node and use the same approach to insert a JPanel
    4. Insert some components (JButton, JLabel ... ) into the JPanel using the 'jPanel1' node and its popup menu
    • EXPECTED RESULT: All nodes are added to Inspector with appropriate hiererchy (JFrame node is superior to jTabbedPane1 etc.). All changes made in Inspector are reflected immediately in the Form editor.
  2. Copying components
    1. In the Inspector window select the 'jPanel1' node and invoke 'Copy' action from its popup menu
    2. Select the 'jTabbedPane1' node and select 'Paste'
    • Verify that 'jPanel2' node is added, containing the same subnodes as jPanel1 (with appropriate names). In the form editor, new tab is added to the Tabbed Pane. It contains the same items as the original one.
    1. Copy and paste jPanel1 node to another location using keyboard shortcut
    2. Copy jPanel1 node by mouse dragging the node to the jTabbedPane1 node with the Ctrl key pressed (small 'plus' sign should appear below the mouse cursor)
    3. Try copying different components between different containers using any of the copy methods
    4. Try invoking the 'Duplicate' action on any node in the Inspector window
    • EXPECTED RESULT: As a node in Inspector is copied/duplicated, the change is immediately reflected in the Form editor - new components are added
  1. Moving components
    1. In the Inspector window select the 'jPanel1' node and invoke 'Cut' action from its popup menu
    2. Select the 'JFrame' node and select 'Paste'
    • Verify that 'jPanel1' node and all its subnodes is moved. In the form editor, the tab from the Tabbed Pane is removed and the JPanel appears in the form .
    1. Cut and paste jPanel1 node to another location using keyboard shortcut
    2. Move jPanel1 node by mouse dragging the node to different location
    • EXPECTED RESULT: As a node in Inspector is moved, the change is immediately reflected in the Form editor
  1. Selecting components
    1. In the Inspector window select some node
    • Verify that appropriate component is selected in the Form editor and Properties window
    1. Select multiple components by Ctrl-clicking on each of them
    2. Select multiple adjacent nodes by clinking on one and Shift-clicking on another
    • Verify that multiple components are selected in the Form editor
    • EXPECTED RESULT: All items selected in Inspector window are selected in Editor and vice versa
  1. Editing components
    1. In the Inspector window select the 'jPanel1' node and invoke 'Change Variable name' from its popup menu
    2. Enter "MyPanel" and confirm
    • Verify that Properties window displays: 'MyPanel [[[JPanel | [JPanel]] - Properties'
    1. Select some JLabel in the Design area of the Editor (place new one to the form if necessary)
    2. (Still in the Design area) Invoke popup menu on the JLabel and select 'Change Variable name'
    3. Type "MyLabel" and confirm
    4. Select 'MyLabel' node in the Inspector and select 'Edit Text' from the popup menu
    5. Type "Lorem Ipsum" as a new text and press Enter or click away
    6. Switch to the source code by selecting View - Editors - Source
    7. Expand Generated Code, and verify following:
    • MyPanel is defined as new instance of javax.swing.JPanel
    • MyLabel is defined as new instance of javax.swing.JLabel
    • 'MyLabel.setText("Lorem Ipsum");' code is present in the code
    1. Switch back to the Design view
    • EXPECTED RESULT: Editing of a component's name and/or text in Inspector takes effect in Properties window and source code immediately.
  1. Deleting components
    1. Delete some node from the Inspector window (try using Delete key, popup menu, and Edit - Delete from IDE menu)
    • EXPECTED RESULT: Appropriate component is removed


Test suite: Property editor

Purpose: Test verifies functionality of component property setting
Expected time: 30 minutes

  • Setup: Start IDE with clear userdir. Create new Java project (called e.g. "MyProject3") with default settings. Create new JFrame Form and name it e.g. "MyJFrame"
  1. Properties window
    1. Select 'MyJFrame.java' node from the Projects window and push 'Properties' from popup menu
    2. Repeat the same in the Files window
    3. Invoke 'Properties' from popup menu of 'Form MyJFrame' node in Inspector window
    • EXPECTED RESULT: All windows show the same properties. Check consistency between newly opened window and Properties window
  2. Folder properties
    1. In Files window select 'myproject3' package
    2. In Properties window, change Sort mode
    • Verify that sort order is changed accordingly
    1. With the package still selected, type 'mypackage' as a new name in Properties
    • Refactoring should be launched and the package renamed. See Issue 130694
    • EXPECTED RESULT: All changes are applied properly.
  1. Changing component's properties I
    1. Open MyJFame in designer and insert JButton into the form
    2. Select the JButton
    3. In Properties window, find 'enabled' property and uncheck the checkbox
    • The JButton becomes disabled. Inspect the source code and verify, that code "jButton1.setEnabled(false);" is present
    1. Change the 'text' and 'toolTipText' property by directly typing new values in the Properties window
    2. Type "100,100,100" as new 'background' property
    3. Try typing 'xxx' as new 'alignmentX' property
    • EXPECTED RESULT: All those properties can be set directly (without opening any new window). Only valid values are acceptable (according to property type, which is diplayed in description field). All changes are reflected in the source code correctly.
  1. Changing component's properties II
    1. Insert another JButton into the form
    2. In its Properties, click on the [[[... | [...]] button, next to 'text' property
    3. In newly opened window, select Get value From: Property
    4. Press the [[[... | [...]] button at the end of the textfield
    5. Select Component: 'jButton1' and Properties: 'text'
    6. Confirm both dialogs
    • Verify that both JButtons have the same text
    1. Select different 'background' of the second JButton, using the Color chooser (by pressing [[[... | [...]])
    2. Click on the [[[... | [...]] button, next to 'icon' property - Image chooser should appear
    3. Choose 'External file', import some graphics file from your harddisk into the Project and use it as icon for the JButton
    4. Save MyJFame and reload it in the editor (close its window and open it again)
    5. Select first JButton and set the same icon, but now using the combobox, next to 'icon property'
    • EXPECTED RESULT: When [[[... | [...]] button is pressed, appropriate dialog is opened. The property can be set with aid of a "chooser", as a value from another component and/or as a custom code. All changes are reflected in the source code correctly.
  1. Changing component's properties III
    1. Insert JList into the form
    2. In the Inspector window, select 'jScrollPane1' node
    3. Open its properties window from the popup menu and edit the 'border' property - Border customizer should appear
    4. Select Bevel Border, set its type to 'Lowered' and change all four colors
    • Verify the setting took effect in the design view, in Preview design window and also in the source code javax.swing.BorderFactory.createBevelBorder is used)
    1. Select the JList and click on the 'model' property (default value="Item 1, Item 2,Item 3,Item 4,Item 5"). Chnage the text to "One, Two, Three" and press Enter
  1. Push [[[... | [...]] to invoke customizer editor of the 'model' property. Three lines (One, Two, Three) should be there. Try to modify the values - add new line, delete one, etc.
    • EXPECTED RESULT: JList should display new modifications. All the changes can be seen in the source code.
  2. Multiple components
    1. Select both JButtons
    2. Push [[[... | [...]] to invoke customizer editor of the 'text' property.
    3. Switch to 'Plain text' and type "Press Me" and confirm
    • Both JButtons should have the same text "Press Me" now
    1. Select jButton1 and jList1. Only properties they have in common should be available in the Properties window.
    2. Uncheck 'enabled' property checkbox
    3. Edit the 'toolTipText' and type some text there. Confirm with Enter
    4. Open the Color chooser to edit 'background' property. Set some color.
    5. Open Preview Design window
    • EXPECTED RESULT: Both jButton1 and jList1 are disabled, have the same background color and the same tooltip text appears as you move the mouse over them.


Test suite: Refactoring

Purpose: Test verifies functionality of Form files refactoring
Expected time: approx. 10 minutes

  • Setup:
    • Create new Desktop application (File - New Project - Java - Java Desktop Application). Change name to "MyApplication, leave other setting unchanged and press 'Finish'
    • Create new JPanel Form in the myapplication package and name it "MyPanel"
    • Place some components into this Panel
    • Compile 'MyPanel.java' file
    • Double click 'MyView.java' in Projects window, and drag 'MyPanel.java' from the Projects into the form
  1. Renaming of the form class
    1. Select 'MyView.java' in the Project window
    2. Press F2
    3. Type "MyViewRenamed" and press Enter
    4. Confirm Refactoring dialog
    • EXPECTED RESULT: The file is renamed successfully. All components are displayed properly. No error is displayed
  2. Renaming of a package
    1. Select 'myapplication' node in the Project Window and select 'Refactor>Rename' from its popup menu
    2. Type "mydata" as a new package name and press 'Refactor'
    3. After refactoring, select 'MyViewRenamed.java' from the 'mydata' package
    4. Invoke 'Open' from its popup menu
    • Form file is opened in Design view and Warning message pops up ("Form Loaded With Errors")
    1. Press 'Cancel'
    2. Select 'mydata' package node and select Run - Compile "mydata" from the IDE menu
    3. Invoke 'Open' on 'MyViewRenamed.java' again
    • EXPECTED RESULT: Form file is opened in Design view. All components are displayed properly. No error is displayed
  1. Moving to another package
    1. Create new package "aa.bb" in MyApplication
    2. Right-click into the Projects window and select 'View Java Packages as > Tree'
    3. Select 'MyViewRenamed.java' and 'MyPanel.java' in the 'mydata' package (Use Ctrl-click or Shift-click)
    4. Drag both files into 'aa' package and confirm Refactoring dialog
    5. Drag the 'MyPanel.java' into 'bb' package and confirm Refactoring dialog
    • EXPECTED RESULT: Files are moved successfully. New package 'properties' is created in the target package, containing .properties file for each form file. Form can be compiled and opened in editor.


Test suite: Database connection

Purpose: Test verifies various methods of using database entries in forms
Expected time: 15 minutes
Setup: You need access to a database with sample tables. This scenario is described for sample Java DB, but the steps can be applied to any database connection

  1. Database application
    1. Invoke New Project wizard
    2. Choose 'Java' Category - 'Java Desktop Application' Project and press 'Next >'
    3. Type e.g. "MyApplication" for Project Name and choose 'Database Application' shell and press 'Next >'
    4. Choose 'jdbc:derby...[[[appOnAPP | [app on APP]]' in Database Connection and change Database Table to 'PRODUCT'
    5. Move all items at once from 'Colums to Include' to 'Available Columns' by pressing the ' << ' button
    6. Move 'PRODUCT_ID', 'MARKUP' and 'DESCRIPTION' back to 'Colums to Include' using the ' > ' button
    7. Press 'Next >'
    8. Don't change any settings on the last screen and press 'Finish'
    • EXPECTED RESULT:
    • Simple CRUD GUI is created. File 'MyView.java' contains table with three colums (Product Id, Markup, Description), three textfields with corresponding labels.
    • 'entityManager', 'query' and 'list' nodes can be seen in Inspector window
    • META-INF package with 'persistence.xml' was created in the Project
    • Project can be run after building it. The table is filled with correct data from the database. You can add, edit and remove any data
    • Teardown: Close the window with the form
  1. Master/Detail Form
    1. Select 'myapplication' package and invoke New File wizard
    2. Choose 'Swing GUI Forms - Master/Detail Sample Form' and press 'Next >'
    3. Change name to e.g. "MyMasterDetail" and press 'Next >'
    4. Choose sample database connection and leave 'CUSTOMER' as Database Table. Press 'Next >'
    5. Check Create Detail Area as Table option
    6. Press "Finish" button
    7. Build the Project and execute the form file (SHIFT + F6)
    • EXPECTED RESULT:
    • Two tables are inside the form
    • Upper table (Master) is filled with data. Once select some row in the Master table, corresponding data appear in the bottom table (Datail)
    • Teardown: Close the window with the form
  1. JTable data binding
    1. Create new JFrame Form in the 'myapplication' package
    2. Insert JTable from the JTable to the form
    3. Switch from Projects to Services window
    4. Select the Sample Database Connection node under 'Databases' (jdbc:derby...[[[appOnAPP | [app on APP]])
    5. If its is not connected, open its popup menu and select 'Connect'
    6. Expand 'Tables' and select 'CUSTOMER'
    7. Drag the 'CUSTOMER' table by mouse and drop it into the JTable in designer (small chain link should appear during the dragging)
    • Verify, that column names are changed (corresponding to db table). EntityManager, Query and List are created (can bee seen under 'Other Components' in Inspector)
    1. Drag another table (e.g. 'PRODUCT') with holding the Ctrl key and drop it into the form
    • EXPECTED RESULT: Another db table is represented in the form. The form file can be run. It contains correct data.


Test suite: Events and Actions

Purpose: Test verifies functionality of creating Event handlers and Actions
Expected time: 15 minutes
Setup: Create new Java project (called e.g. "MyProject4") with default settings. Create new JFrame Form and name it e.g. "MyJFrame". Insert two JButtons and two JLabels into the MyJFrame

  1. New handler from the Properties window - default name
    1. Select jButton1 and click on 'Events' in its Properties window
    2. Expand the combobox , next to the 'actionPerformed' event (the current value displayed is '<none>'
    3. Select 'jButton1ActionPerformed' option (should be offered automatically)
    • EXPECTED RESULT: Source code editor is opened and new private method 'jButton1ActionPerformed' is created. Carret is on a line between two guarded blocks (lines with grey background) and the line can be edited. The guarded block cannot be modified.
    • Switch back to Design view
  2. New handler from the Properties window - custom name
    1. Select jButton1 and click on 'Events' in its Properties window
    2. Click the [[[... | [...]] button to edit 'mouseEntered' event
    3. Click on 'Add...' button
    4. Type e.g. "myHandler" for New Handler Name and confirm the dialog
    5. New handler is added to the list. Confirm the dialog by pressing 'OK'
    • EXPECTED RESULT: Source code editor is opened and new private method 'myHandler' is created. Carret is on a line between two guarded blocks (lines with grey background) and the line can be edited. The guarded block cannot be modified.
  3. Using existing handler
    1. Select jButton2
    2. Click on '<none>', next to the 'mouseEntered' event
    3. change the text manually to "myHandler"
    • EXPECTED RESULT: Source code editor is opened, carret is inside the method 'myHandler' from previous test case. No code is added.
  4. Modifying handlers
    1. Click the [[[... | [...]] button next to 'myHandler' (still in the Events tab of jButton2)
    2. Rename the handler, using the 'Rename...' button
    • Verify that the change took effect - the handler is renamed in Properties window of both JButtons. The method is renamed in the source code.
    1. Click the [[[... | [...]] button next to 'myHandler' again
    2. Select 'myHandler' and press 'Remove'. Confirm with the 'OK' button
    • The 'mouseEntered' event changes to '<none>'. Check the source code - 'myHandler' method is still present and unchanged, as jButton2 still uses it
    1. Select jButton2 and remove myHandler too
    • The 'mouseEntered' event changes to '<none>'. 'myHandler' method is removed from the source code.
    1. Press 2x Undo
    • EXPECTED RESULT: Handlers are set again to both JButtons and the method in source code reappears. All guarded blocks are generated properly.
  1. Adding handlers using popup menu
    1. Select jButton1 in the editor, open its popup menu and select 'Events > Focus > focusGained'
    • Source code editor should open and the handler method is generated
    1. Switch back to Design view
    2. Select jButton2 node in Inspector, open its popup menu and select 'Events > Focus > focusGained'
    • Source code editor should open and the handler method is generated
    • EXPECTED RESULT: Two new methods aer generated. Their names are set automatically
  1. Handler's functionality
    1. Switch to source code editor
    2. Change 'jButton1ActionPerformed' method's body; replace the //TODO line with this code: jLabel1.setText("Action Performed");
    3. Change 'myHandler' method's body; replace the //TODO line with this code: jLabel1.setText("Mouse over - myHandler in action!");
    4. Change 'jButton1FocusGained' method's body; replace the //TODO line with this code: jLabel2.setText("Button 1 has focus");
    5. Change 'jButton2FocusGained' method's body; replace the //TODO line with this code: jLabel2.setText("Button 2 has focus");
    6. Save the file and build the project
    7. Run 'MyJFrame.java' file (Shift+F6)
    • EXPECTED RESULT: All handlers work properly - first label changes when mouse moves over the buttons and when the first button is pressed. Second label informs about focus.
  2. Opening Actions window
    • Setup: Create new Java Project - Java Desktop Application, set name e.g. "MyDesktopApp", leave other setting untouched. Open 'MyDesktopAboutBox' in designer.
    1. Select Window - Other - Application Actions
    • NOTE: This is not available in versions > 6.7
    • EXPECTED RESULT: New window is opened. 'MyDesktopApp' is selected as Project and 'All classes' as Class. There are three actions listed in a table ('closeAboutBox', 'showAboutBox' and 'quit'). After clicking on any of them, appropriate components are displayed in 'Bound components' textarea.
  3. Editing existing action
    1. In the 'Application Actions' window, select the line with 'closeAboutBox' and press the 'Edit Action' button
    • 'Edit Action Properties' dialog should open with 'closeAboutBox' action selected and some values filled
    1. Change the Text value, add some Tooltip text and add both icons (small and large)
    2. Confirm the dialog by pressing 'OK' button
    • EXPECTED RESULT: The text of the JButton is changed and large icon is displayed on the button. Small icon can be seen in the table in 'Application Actions' window. When the application is built and run, you can access the About dialog using "Help - About...". The changes of the JButton (including new tooltip text) can be verified during the runtime
  1. Creating new Action
    1. Open 'MyDesktopView' in designer and place new JButton into into the form
    2. Right click the JButton and select 'Set Action ...'
    3. In the 'New Action' dialog select 'Create New Action...' from the Action combobox
    4. Type "myActionMethod" as Action's method
    5. Fill the Text and Tool Tip values, select both icons
    6. Click into the 'Letter' textbox and press Ctrl+Alt+T - the appropriate checkboxes should become selected and letter "T" is inserted into the textfield
    7. Confirm the dialog by pressing 'OK' button
    • EXPECTED RESULT: Source code editor is opened and new empty method 'myActionMethod' is added. The action is succesfully added, it can be verified in the 'Application Actions' window. In the 'MyDesktopView.properties' file (located in 'resources' package) are generated new data about the myActionMethod.


Test suite: Localization and internationalization

Purpose: Test verifies functionality of localization and internationalization in Form
Expected time: 15 minutes
Setup: Create new Java project (called e.g. "MyProject5") with default settings. Create new JFrame Form and name it e.g. "MyJFrame".

  1. Automatic Internationalization
    1. Open 'MyJFame.java' in designer
    2. In Inspector window select the root node ('Form MyJFame')
    3. Check 'Automatic Internationalization' in the Properties
    4. Insert JLabel and JButton from Pallete to form
    • EXPECTED RESULT: 'Bundle.properties' is generated in the same package as MyJFame. After expanding its node, two subnodes 'MyJFame.jButton1.text' and 'MyJFame.jLabel1.text' are present
  2. Automatic generating of keys and values
    1. Edit text of the JLabel and JButton (using in-place edit by pressing SPACE, or use the popup menu option 'Edit Text')
    2. Set JButton's text to "Press Me" and JLabel's to "Title"
    3. Switch to the source code, expand the block with generated code and inspect the initComponents() method
    4. Right click on 'Bundle.properties' and select 'Edit'
    • EXPECTED RESULT: Source code, bundle keys and values are generated. Source contains this code:
      java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("myproject5/Bundle"); // NOI18N
      

jLabel1.setText(bundle.getString("MyJFame.jLabel1.text")); // NOI18N

jButton1.setText(bundle.getString("MyJFame.jButton1.text")); // NOI18N

and in Bundle.properties there should be generated appropriate keys and values
MyJFame.jLabel1.text=Title
MyJFame.jButton1.text=Press Me
  1. Changing keys and values
    1. Change text of the JButton in the form designer to e.g. "Confirm"
    2. Open JLabel's popum menu, select 'Change Variable Name' and rename it to "MyLabel"
    3. Double-click 'Bundle.properties' node in Projects view
    • Verify, that the changes made in form designer are reflected in Bundle file properly (JButton's text and JLabel's name are changed)
    1. Still in the Bundle.properties editor, change the values for both components and save the file
    2. Switch back to MyJFame
    3. In Inspector window select the root node ('Form MyJFame') and invoke 'Reload Form' from its popup menu
    • EXPECTED RESULT: The changes made in Bundle file are displayed in the form (text of both components is changed)
  1. Add Locale
    1. Select 'Bundle.properties' node in Projects view and open its popup menu
    2. Invoke 'Add > Locale'
    3. Either fill custom values using the three comboboxes or choose Predefined Locale
    4. Confirm the dialog. New Locale is created, containing the same keys as 'default language'
    5. Open 'MyJFame.java' in designer
    6. In Inspector window select the root node ('Form MyJFame')
    7. In the Properties window change value of 'Design lacale' to the newly added Locale
    8. Edit the text of both components in the form
    9. Right-click on the 'Bundle.property' file and select 'Open'
    • EXPECTED RESULT: Bundle editor is opened. Table with three columns is displayed (key, default language, {your locale name}). The values can be edited directly. All changes made here are reflected in the form (reloading is required) and vice versa.
  2. Handling more Locales
    1. Open the Bundle editor (right-click 'Bundle.property' and choose 'Open')
    2. Add more Locales, using the 'Add Locale' option
    3. Delete any Locale by deleting its node from Projects window
    4. Rename some Locale by selecting its node and pressing F2
    • EXPECTED RESULT: All those changes are reflected in the editor correctly


Test suite: Beans binding

Purpose: Test verifies basic beans binding functionality
Expected time: 15 minutes
Setup: Continue with the project from last test suite. Create new JFrame Form and name it e.g. "MyJFrame2". Insert two JLabels into this form and change their names to "lblTarget" and "lblSource". Change their text to "target" and "source"

  1. Bindint text property
    1. Invoke popup menu for lblTarget node in Inspector window
    2. Click "Bind > text" menu item
    3. In Bind dialog in Binding source select lblSource component
    4. In Bind Expression tree combo list doubleclik on "text java.lang.String" node and press OK
    • EXPECTED RESULT: Text values are now binded. If source label's text is changed, target changes accordingly.
  2. Runtime changes - Always sync
    • Setup: Place two JButtons into the form, change their names to "btnTarget" and "btnSource". Change their text to "Change target" and "Change source"
    1. Create actionPerform event handlers for both JButtons (either double click the JButton or select "Events > Action > actionPerformed etc.)
    2. Into btnTargetActionPerformed handler paste: lblSource.setText(lblSource.getText() + "+");
    3. Into btnSourceActionPerformed handler paste: lblTarget.setText(lblTarget.getText() + "+");
    4. Execute the form file (Shift + F6) and press btnSource and btnTarget
    • EXPECTED RESULT: By pressing any of the JButtons, both labels are changed the same way
    • Teardown: Close the window
  3. Runtime changes - Read from source
    1. Select lblTarget in Inspector view
    2. In Properties window, select 'Binding' panel, find the 'text' option (it should contain 'lblSource[[[${text} | [${text}]]') and press [[[... | [...]] button
    3. In Bind dialog select 'Advanced' tab, change Update Mode to "Only read from source (read-only)" and press OK
    4. Save the file and run it
    • EXPECTED RESULT: Changing the source label reflects in the target label, while changing target label does not have any inpact on the source label.
  4. Runtime changes - Read from source once
    1. Invoke popup menu for lblTarged node in Inspector window
    2. Click "Bind > text" menu item
    3. In Bind dialog select 'Advanced' tab, change Update Mode to "Read from source once (read once)" and press OK
    4. Execute the form file (SHIFT + F6) and press btnSource and btnTarget
    • EXPECTED RESULT: Binding takes effect only after frame start (labels have the same text)
  5. Null value
    • Setup: Insert another JLabel and JButton to the form. Change name of the JLabel to "lblNull"
    1. Invoke bind dialog for text property of lblNull
    2. In Bind dialog in Binding source select lblSource
    3. In Bind Expression select toolTipText property (this property should be null now)
    4. Go to Advanced tab and check "Null Source Value" checkbox
    5. Type text "This item is null" into the textfield and press OK
    • EXPECTED RESULT: The text of the JLabel should change to 'This item is null' - it should be visible both in the designer and during the runtime


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