TS 61 codegenerator

Form Editor - Code Generation Test Specification

Author: Jana Maleckova, Jaromir Uhrik
Version: 6.5, 7.0
Lastupdate:2010/10/15
Introduction: This is intended as Code Generation tests for created Swing/AWT files and components.

Contents


Test suite: Create forms from Templates

Purpose:
Setup: Start IDE with clear userdir. Create new project, Java Application (e.g. MyApplication).

  1. Create new JApplet
    1. Select MyApplication/Source Packages/myapplication in the Project view
    2. Choose from popup New | Other...
    3. Choose Swing GUI Forms > JApplet Form and press Next> button.
    4. In New Wizard type name "MyJApplet"
    5. Push Finish
    • EXPECTED RESULT: The JApplet is created successfully. A user can correctly view the JApplet in the Design view, and the Editor view.
  2. Create new JDialog
    1. Select MyApplication/Source Packages/myapplication in the Project view
    2. Choose from popup New | Other...
    3. Choose Swing GUI Forms > JDialog Form and press Next> button.
    4. In New Wizard type name "MyJDialog"
    5. Push Finish
    • EXPECTED RESULT: The JDialog is created successfully. A user can correctly view the JDialog in the Design view, and the Editor view.
  3. Create new JFrame
    1. Select MyApplication/Source Packages/myapplication in the Project view
    2. Choose from popup New | Other...
    3. Choose Swing GUI Forms > JFrame Form and press Next> button.
    4. In New Wizard type name "MyJFrame"
    5. Push Finish
    • EXPECTED RESULT: The JFrame is created successfully. A user can correctly view the JFrame in the Design view, and the Editor view.
  4. Create new JInternalFrame
    1. Select MyApplication/Source Packages/myapplication in the Project view
    2. Choose from popup New | Other...
    3. Choose Swing GUI Forms > JInternalFrame Form and press Next> button.
    4. In New Wizard type name "MyJInternalFrame"
    5. Push Finish
    • EXPECTED RESULT: The JInternalFrame is created successfully. A user can correctly view the JInternalFrame in the Design view, and the Editor view.
  5. Create new JPanel
    1. Select MyApplication/Source Packages/myapplication in the Project view
    2. Choose from popup New | Other...
    3. Choose Swing GUI Forms > JPanel Form and press Next> button.
    4. In New Wizard type name "MyJPanel"
    5. Push Finish
    • EXPECTED RESULT: The JPanel is created successfully. A user can correctly view the JPanel in the Design view, and the Editor view.
  6. Create new Bean based on javax.swing.JPanel
    1. Select MyApplication/Source Packages/myapplication in the Project view
    2. Choose from popup New | Other...
    3. Choose Swing GUI Forms > Bean Form and press Next> button.
    4. In New Wizard type name "BeanOnJPanel"
    5. Push Next
    6. In New Wizard type superclass "javax.swing.JPanel"
    7. Push Finish
    • EXPECTED RESULT: The Bean Form is created successfully. A user can correctly view the Bean Form in the Design view, and the Editor view. The parent class of BeanOnJPanel should be JPanel.
  7. Create new Bean based on javax.swing.JButton
    1. Select MyApplication/Source Packages/myapplication in the Project view
    2. Choose from popup New | Other...
    3. Choose Swing GUI Forms > Bean Form and press Next> button.
    4. In New Wizard type name "BeanOnJButton"
    5. Push Next
    6. In New Wizard type superclass "javax.swing.JButton"
    7. Push Finish
    • EXPECTED RESULT: The Bean Form is created successfully. A user can correctly view the Bean Form in the Design view, and the Editor view. The parent class of BeanOnJButton should be JButton.
  8. Create new Bean based on java.awt.Panel
    1. Select MyApplication/Source Packages/myapplication in the Project view
    2. Choose from popup New | Other...
    3. Choose Swing GUI Forms > Bean Form and press Next> button.
    4. In New Wizard type name "BeanOnPanel"
    5. Push Next
    6. In New Wizard type superclass "java.awt.Panel"
    7. Push Finish
    • EXPECTED RESULT: The Bean Form is created successfully. A user can correctly view the Bean Form in the Design view, and the Editor view. The parent class of BeanOnJPanel should be Panel.
  9. Create new Applet
    1. Select MyApplication/Source Packages/myapplication in the Project view
    2. Choose from popup New | Other...
    3. Choose AWT GUI Forms > Applet Form and press Next> button.
    4. In New Wizard type name "MyApplet"
    5. Push Finish
    • EXPECTED RESULT: The Applet is created successfully. A user can correctly view the Applet in the Design view, and the Editor view.
  10. Create new Frame
    1. Select MyApplication/Source Packages/myapplication in the Project view
    2. Choose from popup New | Other...
    3. Choose AWT GUI Forms > Frame Form and press Next> button
    4. In New Wizard type name "MyFrame"
    5. Push Finish
    • EXPECTED RESULT: The Frame is created successfully. A user can correctly view the Frame in the Design view, and the Editor view.
  11. Create new Panel
    1. Select MyApplication/Source Packages/myapplication in the Project view
    2. Choose from popup New | Other...
    3. Choose AWT GUI Forms > Panel Form and press Next> button.
    4. In New Wizard type name "MyPanel"
    5. Push Finish
    • EXPECTED RESULT: The Panel is created successfully. A user can correctly view the Panel in the Design view, and the Editor view.
  12. Create new Application
    1. Select MyApplication/Source Packages/myapplication in the Project view
    2. Choose from popup New | Other...
    3. Choose Swing GUI Forms > Application Sample Form and press Next> button.
    4. In New Wizard type name "MyApplication"
    5. Push Finish
    • EXPECTED RESULT: The Application is created successfully. A user can correctly view the Application in the Design view, and the Editor view. MyApplication should extend JFrame.
  13. Create new MDI Application
    1. Select MyApplication/Source Packages/myapplication in the Project view
    2. Choose from popup New | Other...
    3. Choose Swing GUI Forms > MDI Application Sample Form and press Next> button.
    4. In New Wizard type name "MyMDIApplication"
    5. Push Finish
    • EXPECTED RESULT: The MDI Application is created successfully. A user can correctly view the MDI Application in the Design view, and the Editor view. MyMDIApplication should extend JFrame.
  14. Create new Ok/Cancel Dialog
    1. Select MyApplication/Source Packages/myapplication in the Project view
    2. Choose from popup New | Other...
    3. Choose Swing GUI Forms > OK / Cancel Dialog Sample Form and press Next> button.
    4. In New Wizard type name "MyOKCancelDialog"
    5. Push Finish
    • EXPECTED RESULT: The Ok/Cancel Dialog is created successfully. A user can correctly view the Ok/Cancel Dialog in the Design view, and the Editor view. MyOKCancelDialog should extend JDialog.
  15. Create new Master/Detailed Sample Form
    1. Select MyApplication/Source Packages/myapplication in the Project view
    2. Choose from popup New | Other...
    3. Choose Swing GUI Forms > Master/Detailed Sample Form and press Next> button.
    4. In New Wizard type name "MyMasterForm" and press Next> button.
    5. Choose database connection
    6. Choose database table from your selected database and press Next> button
    7. Push Finish
    • EXPECTED RESULT: The Master/Detailed Sample Form is created successfully. A user can correctly view the Master/Detailed Sample Form in the Design view, and the Editor view. MyMasterForm should extend JPanel.


Test suite: Code Generation of beans properties

Purpose:
Setup: Start IDE with clear userdir. Create new project, Java Application (e.g. MyApplication).

  1. Change properties of components
    1. Open/Create MyJFrame
    2. Select/add component JLabel1
    3. Change properties for selected component
    4. Assure generated code
    5. Repeat this test for: JButton, JToggleButton, JCheckBox, JRadioButton, JComboBox, JList, JTextField, JTextArea, JPanel, JScrollPane, JMenuBar, JPopupMenu, JSlider, JProgressBar, JSplitPane, JPasswordField, JSeparator, JSpinner, JFormattedTextField, JTextPane, JEditorPane, JTree, JToolBar, JInternalFrame, JLayeredPane, JDesktopPane, JOptionPane, JColorChoser, JFileChooser, JFrame, JDialog, JMenuItem, JCheckBoxMenuItem, JRadioButtonMenuItem, JMenu, Label, Button, TextField, TextArea, CheckBox, Choice, List, ScrollBar, ScrollPane, Panel, Canvas, MenuBar, MenuItem, CheckBoxMenuItem, Menu, Separator
    • EXPECTED RESULT: Assure generated code.
  2. Generate code from Customize Bean
    1. Add own bean that is compiled to Palette (in explorer invoke popup on a bean and select Tools | Add to Palette... - then select category and press OK)
    2. Create a new form
    3. Add bean to this form
    4. Set properties for selected bean
    • EXPECTED RESULT: Assure generated code.


Test suite: Test of Generation Fully Qualified Names

Purpose: Test if variables are/aren't generated with Fully Qualified Names
Setup: Start IDE with clear userdir. Create new project, Java Application (e.g. MyApplication) and create a new JFrame.

  1. Check if property "Generate Full Classnames" is checked"
    1. Select root node in Design View Navigator.
    2. Check property "Generate Full Classnames" on Property Sheet
    • EXPECTED RESULT: This property should be checked by default
  2. Test if FQN are not generated
    1. Place e.g. jLabel in Frame
    2. Select root node in Design View Navigator.
    3. Uncheck option "Generate Full Classnames" in Properties
    4. Switch to Editor
    • EXPECTED RESULT: Declaration of jLabel variable should look like:
      private JLabel jLabel1;
      and all appropriate imports should be added at the beging of the class. No error badges should appear.
  3. Test if FQN are generated
    1. Use Frame from previous testcase
    2. Select root node in Design View Navigator.
    3. Check option "Generate Full Classnames" in Properties
    4. Switch to Editor
    • EXPECTED RESULT: Declaration of jLabel variable should look like:
      private javax.swing.JLabel jLabel1;
      and all imports generated from previous testcase should be marked as Unused and can be removed. No error badges should appear.
  4. Test FQN together with option
    1. Create new Frame and place jLabel
    2. Uncheck FQN property and check "Local Variables" property which is on the same property sheet
    3. Switch to Editor
    • EXPECTED RESULT: Part for Variables declaration should be empty and initComponent() method should contain code
      JLabel jLabel1 = new JLabel();
      All needed imports should be imported.
  5. Test FQN together with option
    1. Use Frame from previous testcase
    2. Check FQN property
    3. Switch to Editor
    • EXPECTED RESULT: Part for Variables declaration should be empty and initComponent() method should contain code
      javax.swing.JLabel jLabel1 = new javax.swing.JLabel();
      All imports imported from previous testcase should became unused.


Test suite: Testing of Guarded Blocks

Purpose: To test if it is not possible to edit Guarded Blocks in Editor
Setup: Start IDE with clear userdir. Create new project, Java Application (e.g. MyApplication)

  1. Editing of Guarded Blocks - InitComponents in Editor
    1. Create e.g. JFrame
    2. Switch to Source from Design
    3. Try to edit code in InitComponents() - just try to write some code there
    • EXPECTED RESULT: "Guarded Block should not be possible to edit"
  2. Editing of Guarded Blocks - Action Handler in Editor
    1. Create e.g. JFrame
    2. Place some Control
    3. Generate actionPerformed handler for this control
    4. Switch to Source from Design
    5. Try to edit guarded section of handler (generated under initComponent()) press Enter, letters, code format ... etc.
    • EXPECTED RESULT: Guarded section should not be possible to edit


Test suite: Accessibility

Purpose: Assure appearance of Accessibility(A11Y) node in properties of components. Assure proper generated code.
Setup: Start IDE with clear userdir. Create new project, Java Application (e.g. MyApplication) and create a new JFrame.

  1. Appearance of Accessibility node for components
    1. Add step by step all components to form from tabs Swing, AWT
    2. Assure occurrence of an Accessibility node in propertysheet (tab Properties)
    • EXPECTED RESULT: All components have an Accessibility node in properties except: ButtonGroup.
  2. Appearance of Accessibility node for top containers
    1. Create all Gui form offered by IDE: JForm, JDialog, JFrame, JInternalFrame, JPanel, Applet, Form, Frame, Panel
    2. Select Top Container in Design View Navigator.
    3. Assure occurrence of an Accessibility node in propertysheet (tab Properties)
    • EXPECTED RESULT: All top-containers have an Accessibility node in properties.
  3. Appearance of an Accessibility node for menu components
    1. Add to JForm JMenu, JPopupMenu
    2. For JMenu add JMenuItem, JCheckBoxMenuItem, JRadioButtonMenuItem, JMenu, JSeparator
    3. Assure occurrence of an Accessibility node in propertysheet (tab Properties)
    • EXPECTED RESULT: All menu components have an Accessibility node in properties.
  4. Generated code for Accessibility
    1. Add JButton to form
    2. Change all Accessibility properties: Accessibility Name, Accessibility Description, Accessibility Parent
    3. Assure generated code
    4. Repeat this test for Button, JMenuItem, JForm - top container
    • EXPECTED RESULT: Code is generated properly.
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