TS 74 Templates

Test Specification for File Types and Project Templates

Author: Hermien Pellissier
Version: NetBeans 7.4
Last update: 26 August 2013
Introduction: Test cases for testing of file types and project templates support in the NetBeans platform.

Contents


Test suite: New File Type Wizard

Purpose: Verifying that the New File Type Wizard generates the correct code for registering a new file type in a platform application.
Setup: Create a new stand alone NetBeans module with code name base "test". This module will be used throughout the rest of the tests, and where applicable this will be referred to as Module A. An icon will be required during the process (one can be downloaded here).

  1. Invalid MIME Type
    1. Select the "test" package in the newly created module.
    2. Choose File | New File... from the main IDE menu bar.
    3. Under categories select Module Development and under File Types select File Type.
    4. Click Next.
    5. Type an invalid MIME Type such as "abc".
    • EXPECTED RESULT: The Next and Finish buttons remain disabled and an error message is displayed.
  2. Valid MIME Type
    1. Change the MIME Type to the valid value "text/abc" (without the quotes).
    2. Choose the "by Filename Extension" option and enter "abc" for the extension.
    • EXPECTED RESULT: The Next and Finish buttons are enabled.
  3. Invalid Class Name Prefix
    1. Click next.
    2. On the "Name, Icon and Location" page, enter an invalid Class Name Prefix, e.g. a name starting with a digit.
    • EXPECTED RESULT: The next and finish buttons are disabled and an error message is displayed.
  4. Valid Class Name Prefix and Icon
    1. Enter a the following valid class name prefix: ABC.
    2. Choose a valid icon file.
    • EXPECTED RESULT: The finish button is enabled.
  5. Code Generation
    1. Click Finish.
    • EXPECTED RESULT: The following files are created in the test package: ABCDataObject.java, ABCTemplate.abc, ABCVisualElement.java. The icon should be copied to the package too.
    • EXPECTED RESULT: Both the ABCVisualElement and ABCDataObject classes should have annotations that are used to register them with the platform.
  6. Testing the behaviour of the new file type module
    1. Right click on the module and choose Run.
    2. In the platform application that starts up, choose File | New Project. Create a new Java Application.
    3. Select the new project in the Projects view.
    4. Go to File | New File... on the main menu bar.
    5. Under categories choose Other and under File Types choose ABCTemplate.abc.
    6. Click the Next button.
    7. Specify a file name and click Finish.
    • EXPECTED RESULT: A new file is created with some sample content.

Test suite: New Project Template Wizard

Purpose: Verifying that the New Project Template Wizard generates the correct code for registering a new project in a platform application.
Setup: A project template is created from an existing project. We will re-use the project created in the previous test suites (Module A) for this purpose. Module A should be open in the IDE at the start of this test suite. Create another standalone module (Module B) with code name base "template".

  1. Invalid Template Name
    1. Select the "template" package in the newly created module.
    2. Choose File | New File... from the main IDE menu bar.
    3. Under categories select Module Development and under File Types select Project Template.
    4. Click Next.
    5. Select Module A from the list of projects.
    6. Click Next.
    7. Type an invalid Template Name, such as a name starting with a digit.
    • EXPECTED RESULT: The Next and Finish buttons remain disabled and an error message is displayed.
  2. Valid Template Name
    1. Change the template name to the following valid value: ABCProject
    • EXPECTED RESULT: The error message changes to indicate that the Display Name should be specified.
  3. Valid Display Name
    1. Change the display name to the following valid value: ABCProject
    • EXPECTED RESULT: The error message is no longer displayed and the Finish button is enabled.
  4. Generating the Code
    1. Enter the following display name: ABC Project
    2. Choose the APISupport Category if not already selected by default.
    3. Click Finish.
    • EXPECTED RESULT: The following files are created: ABCProject.png, ABCProjectDescription.html, ABCProjectPanelVisual.java, ABCProjectProject.zip, ABCProjectWizardIterator.java, ABCProjectWizardPanel.java.
    • EXPECTED RESULT: The ABCProjectWizardIterator class has a @TemplateRegistration annotation.
  5. Testing the behaviour of the new project template module
    1. Right click on Module B and choose Run.
    2. In the platform application that starts up, choose File | New Project.
    3. Choose the Netbeans Modules category, and pick ABC Project from the Projects list.
    4. Click Next.
    5. Specify a location for the new project and click Finish.
    • EXPECTED RESULT: A new project is created with the same structure as Module A.
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