TS 73 FormAndSupportSanity

Form Editor & Support Modules - Sanity Test Specification

Author: Pavel Pribyl Adam Šenk update: Marcin Starnacki
Version: 7.3
Lastupdate: 2012/09/26
Introduction: Test specification for Form and Support Modules. It serves only for a quick walk-through of basic functions of those modules.
Estimated duration: 2 hours

Contents


Test suite: Java Help

Purpose: Test verifies functionality of Java Help
Expected time: 10 minutes
Setup: Start IDE with clear userdir

  1. Help window functionality
    1. Press F1 or select Help - Help Contents from the menu to open the Help window
    • EXPECTED RESULT: New window with "Help" title is opened.
  2. Search
    1. Open the Help window
    2. Select the 'Search' tab
    3. Type something reasonable into the search textfield (e.g. 'Netbeans', 'refactoring' etc.) and press Enter
    4. Type some nonsense into the search textfield (e.g. 'asdfghj') and press Enter
    • EXPECTED RESULT: When search is successfull (in the first case), list of topics appears on the left side, one of them is selected and displayed on the right side. The searched term is highlighted.
  3. Contextual Help
    1. Select File - New Project from the menu
    2. Press the 'Help; button
    • EXPECTED RESULT: New window with "Help" title is opened. It contains information about the New Project Wizard
    • NOTE: Try pressing the 'Help' button whenever it is possible when going through all test cases in this Test Specification. Allways check that appropriate content is displayed


Test suite: Creating of Form files

Purpose: Test verifies basic aspects of Form files creation
Expected time: 15 minutes
Setup: 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 Navigator.
  2. Create a GUI container using package content menu
    1. In the Projects window, right-click the 'myproject' (package) and choose New > Other ... > 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) and click the 'New File' icon File:newFile.png in the IDE's toolbar
    2. Choose 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 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
    2. Create following AWT GUI components (new file from 'AWT GUI Forms' Category)
      • Applet Form
      • Dialog Form
      • Frame Form
      • Panel Form
    3. 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.


Test suite: Visual development

Purpose: Test verifies functionality of GUI builder, manipulating with components and visual feedback
Expected time: approx. 30 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
    2. In the Palette window, select the JPanel component from 'Swing Containers' category, by clicking (and releasing) the mouse button
    3. 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
    4. 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 Navigator window as a sub-node of JFrame node. It is also selected in the Properties window.
  2. 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 clicked the form). Resize handlers should appear after JPanel selection.
    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
    3. Move the JPanel by clicking inside it, holding the mouse button and moving the mouse
    4. Release the mouse button in desired position
    5. Move the JPanel again, now try to place it outside the form
      • JPanel disappears from the form, jPanel node in the Navigator window moves from JFrame to Other Components
    6. 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.
  3. 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.
      • Navigator 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 Navigator window displays the component hierarchy
  4. 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
    4. Repeat previous steps, but instead of pressing Enter, click outside the edited JButton
      • The text of the JButton should be changed too
    5. Try in-place editing on other components with a text label: JLabel, JCheckBox, JRadioButton and JToggleButton
    • EXPECTED RESULT: Custom text is set properly.
  5. 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
    4. Click on one of the selected components, hold down the mouse button and move the whole group to another place in the JPanel
    5. Place the group outside the JPanel
      • Ensure that Navigator window is updated (those three components become subnodes of JFrame)
      • Note: If selected components are located in different containers, moving is NOT possible
    6. Undo previous action
      • All three components should return to their original position in the JPanel
    7. Click anywhere into the form and hold the mouse button
    8. Drag a rectangular selection area over some components of the form
    9. Release the mouse button
      • Verify that all components located inside the selection area are selected
    10. 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.
  6. 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 Navigator window. Properties window change and display properties of the JScrollPane
  7. 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 Navigator 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
  8. Designing container/parent
    1. Double click on the scrollbars of the JScrollPane in the editor
      • Result: Only the JSrollPane and its content is displayed
    2. 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
    3. Double click on the JPanel again
    • EXPECTED RESULT: The original form is displayed. No component is changed.
  9. 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.
  10. 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
    6. Switch back to the original form
    7. 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
  11. 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.
  12. 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.)
  13. 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
    • 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.
  14. Copy, Paste, Duplicate and Delete
    1. Select any component of the Form and press Ctrl+C and Ctrl+V
    2. Select multiple components and invoke Copy and Paste from the popup menu
    3. Try deleting single/multiple components using various approaches (pressing Delete key or invoking Delete option from the menu)
    4. Verify functionality of the Duplicate option - identical copy of selected component(s) should be created
    • NOTE: Try also invoking all those actions on nodes in the Navigator view
    • EXPECTED RESULT: All actions work as expected and are Undo/Redo-able
  15. Changing Layout
    1. Right-click on the [JFrame] node in the Navigator and select 'Set Layout >'
    2. Try selecting all of the available layouts. Press Undo after each layout change.
    • EXPECTED RESULT: Every layout can be set. Its node appears in the Navigator tree. Components of the Form are re-arranged according to the sellected layout. Presing Undo takes back all the changes. Grid Bag layout can be further customized using the 'Customize Layout' option.
    • NOTE: Try also changing layouts of swing containers (JPanels etc.) inside the JFrame Form - each container can have its own layout.


Test suite: Property editor

Purpose: Test verifies functionality of component property setting
Expected time: 20 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. Folder properties
    1. In Files window select 'myproject3' package
    2. In Properties window, change Sort mode
      • Verify that sort order is changed accordingly
    • EXPECTED RESULT: All changes are applied properly.
  2. Changing component's properties I
    1. Open MyJFrame 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
    4. Change the 'text' and 'toolTipText' property by directly typing new values in the Properties window
    5. Type "100,100,100" as new 'background' property
    6. 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.
  3. 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 in combobox: Value From Existing Component and 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
    7. Select different 'background' of the second JButton, using the Color chooser (by pressing [[[... | [...]])
    8. Click on the [[[... | [...]] button, next to 'icon' property - Image chooser should appear
    9. Choose 'External file', import some graphics file from your harddisk into the Project and use it as icon for the JButton
    10. Save MyJFame and reload it in the editor (close its window and open it again)
    11. 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.
  4. Changing component's properties III
    1. Insert JList into the form
    2. In the Navigator 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 - 1' 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)
    5. 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
    6. 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.
  5. 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
    4. Select jButton1 and jList1. Only properties they have in common should be available in the Properties window.
    5. Uncheck 'enabled' property checkbox
    6. Edit the 'toolTipText' and type some text there. Confirm with Enter
    7. Open the Color chooser to edit 'background' property. Set some color.
    8. 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 Java Application (File > New Project - Java - Java Application). Change name to "RefactorTest", leave other setting unchanged and press 'Finish'
  • Create new JPanel Form in the "refactortest" package and name it "MyPanel"
  • Place some components into this Panel
  • Compile 'MyPanel.java' file
  • Create new JFrame Form in the "refactortest" package and name it "MyView"
  • Place some components into this JFrame Form
  • Drag 'MyPanel.java' from the Projects into the "MyView" 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 'refactortest' 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")
    5. Press 'Cancel'
    6. Select 'mydata' package node and select Run - Compile "mydata" from the IDE menu
    7. Invoke 'Open' on 'MyViewRenamed.java' again
    • EXPECTED RESULT: Form file is opened in Design view. All components are displayed properly. No error is displayed
  3. Moving to another package
    1. Create new package "mydata.sub" in RefactorTest
    2. Open 'MyViewRenamed.java' in designer
    3. In Navigator window select the root node ("MyViewRenamed")
    4. Check 'Automatic Internationalization' in the Properties
    5. "Bundle.properties" is generated in the same package as "MyViewRenamed". It contains all keys and values.
    6. Drag "MyViewRenamed" into 'mydata.sub' package and confirm Refactoring dialog
    • EXPECTED RESULT: File is moved successfully. New file "Bundle.properties" is created in "mydata.sub" package and contains all keys and values. "Bundle.properties" in "mydata" package is empty. 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: 10 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. Master/Detail Form
    1. Create new Java project
    2. Invoke New File wizard
    3. Choose 'Swing GUI Forms - Master/Detail Sample Form' and press 'Next >'
    4. Change name to e.g. "MyMasterDetail" and press 'Next >'
    5. Choose sample database connection and leave 'CUSTOMER' as Database Table. Press 'Next >'
    6. In section "Create Detail Area as": check "Table" option
    7. Press "Finish" button
    8. 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
  2. JTable data binding
    1. Create new JFrame Form in project from previous testcase
    2. Insert JTable from the Pallete 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 Navigator)
    8. 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

Purpose: Test verifies functionality of creating Event handlers
Expected time: 10 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.
    3. Click the [[[... | [...]] button next to 'myHandler' again
    4. 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
    5. Select jButton2 and remove myHandler too
      • The 'mouseEntered' event changes to '<none>'. 'myHandler' method is removed from the source code.
    6. 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.
  5. 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
    2. Switch back to Design view
    3. Select jButton2 node in Navigator, 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 are generated. Their names are set automatically
  6. 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.


Test suite: Localization and internationalization

Purpose: Test verifies functionality of localization and internationalization in Form
Expected time: 10 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 Navigator 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
  3. 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)
    4. Still in the Bundle.properties editor, change the values for both components and save the file
    5. Switch back to MyJFame
    6. In Navigator 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)
  4. 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 Navigator window select the root node ('Form MyJFame')
    7. In the Properties window change value of 'Design locale' to the newly added Locale
    8. Edit the text of both components in the form
    9. Right-click on the 'Bundle.properties' 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.
  5. Handling more Locales
    1. Open the Bundle editor (right-click 'Bundle.properties' 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: JUnit

Purpose: Test verifies basic functionality of JUnit support
Expected time: 20 minutes
Setup: Start IDE with clear userdir. Create new Java Application containing several Java classes and testable methods
(or download and open JUnitSanity.zip - small project with no functionality, but it contains some classes, abstract classes, interfaces (also inheritance) with testable methods.)

  1. "Test files"
    1. Select a package in your project and invoke 'Tools > Create JUnit Tests' from its content menu
    2. Choose one of the JUnit versions
    3. Ensure that all checkboxes in the "Create Tests" dialog are chcecked
    4. Press OK
    • EXPECTED RESULT: Package with the same name is created in the "Test Packages" folder. One test file is created for each class in tested package. There is also a test suite created. Test filenames are "[[[TestedClassName | [TestedClassName]]Test.java, suite filename is "[[[PackageName | [PackageName]]Suite.java. Files are created without errors."
  2. "Create New JUnit Test"
    1. Select "Test Packages" and invoke 'File - New File (Ctrl+N)'
    2. Choose "Junit - JUnit Test"
    3. press Next >
    4. Type "mypackage" for 'Package:' Leave other setting unchanged
    5. Press Finish
    • EXPECTED RESULT: New test file with no test methods is created in "mapackage" package
  3. "Running and debugging of a single test file"
    1. Select a file from different package than in previous test case
    2. Create new JUnit test by pressing CTRL + SHIFT + U
    3. Test all ways of running test for this file:
      • Invoke 'Test File (Ctrl+F6)' from file's popup menu
      • Invoke 'Run File (Shift+F6)' from popup menu of corresponding test file in Test Packages
      • Invoke 'Test File (Ctrl+F6)' from popup menu of this test file
      • EXPECTED RESULT: All methods of running single test are available and functional. Test Results window is opened after successfull test run.
    4. Place a line breakpoint into some method in the test file. Test all ways of debugging test:
      • Invoke 'Debug Test File (Ctrl+Shift+F6)' from the original(tested) file's popup menu
      • Invoke 'Debug File (Ctrl+Shift+F5)' from popup menu of corresponding test file in Test Packages
      • Invoke 'Debug Test File (Ctrl+Shift+F6)' from popup menu of this test file
      • EXPECTED RESULT: All methods of debugging single test are available and functional. Debugger stops at the breakpoint. Test Results window is opened after successfull test debugging.
  4. "Testing the whole project"
    1. Open several test files created in previous steps and modify some of their methods, so the test will pass
      (delete the fail... methods and modify the expected result in the generated code)
    2. Select project root node and invoke 'Test (Alt+F6)' from its content menu
    • EXPECTED RESULT: Test Results window is displayed with results of all tests. Progress bar shows the percentage of passed tests, test classes and their methods are displayed as a nodes of a tree. File:Test Result Window
  5. "Test Results window - tooltips"
    1. Move the mouse cursor over the nodes in the Test Results window
    • EXPECTED RESULT: Tooltips are displayed with the test output. The output of all tests is also displayed in the right part of the Test Results window
  6. "Rerun"
    1. Press the "Rerun" button (with green fastforward icon)
    • EXPECTED RESULT: All tests are run again
  7. "Filter button"
    1. Toggle/untoggle filter button (labeled "Show Failed")
    • EXPECTED RESULT: Only failed tests are shown if the button is toggled.
  8. "Previous/Next Failure"
    1. Press the UP or DOWN ARROW button
    • EXPECTED RESULT: Previous/Next failure node is highlighted. it is possible to cycle through all failures
  9. "Navigation"
    1. In results tree doubleclick on some nodes, representing either test class or test method
    2. Try also doubleclicking on a stacktrace under some failed method's node
    • EXPECTED RESULT: It will open appropriate test file in the editor and focus is on the class/method definition
  10. "Go to Source"
    1. Repeat the previous steps, but inhstead of doubleclicking select "Go to Source" from the popup menu
    • EXPECTED RESULT: It will open appropriate test file and focus is on the class/method (same result as doubleclicking on the node)
  11. "Run Again"
    1. Select "Run Again" from some test method node's popup menu
    • EXPECTED RESULT: Only the corresponding test method is run (NOT the whole test)
  12. "Debug"
    1. Go to a source code of any test method
    2. Place a breakpoint on any line of this method
    3. Select "Debug" from the corresponding node's popup menu
    • EXPECTED RESULT: The debugger is run and it stops at the breakpoint
  13. "View Difference"
    1. Run tests for the whole project again (Alt+F6)
    2. Select a node where the test failed because of different expected and actual value (contains text: "expected<...> but was <...>")
    3. Select "View Difference" from the node's popup menu
    • EXPECTED RESULT: New window is opened. Both values, Expected and Actual, can be seen


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