Working with test projects and units

All resources in an Eclipse-based platform are contained in projects, as described in Projects.. You must create integration component library projects to contain integration components, you must create user projects to contain shortcuts to components, and you must create test projects in the Integrated Test Environment to contain definitions for tests.

A test unit is a resource created in the workbench that defines a test. Integrated Test Environment is designed to let you test an entire interface, and an interface typically centers around a collaboration object, as described in Interfaces, so a test unit centers around a collaboration object as well. You can define all the test units you want to run in a single test project, or can create multiple test projects and add test units to them as appropriate to organize them according to your preference.

Configuring test project preferences

Before creating either test projects or test units you should configure the preferences related to both. Do the following to configure your preferences related to test projects and units:

  1. Select Window > Preferences from the menu bar of the workbench.
  2. Select Integrated Test Environment.

    Figure 73 shows the Integrated Test Environment preferences.

    Figure 73. Integrated Test Environment preferences


  3. Enable the Create a default Integrated Test Environment project automatically if none exists check box if you want Integrated Test Environment to create a default project named DefaultITEProject if you are creating a test unit and no project already exists.
  4. Enable the Open the new test unit in the editor upon creation check box if you want to automatically open a test unit definition in the Test Unit Editor after you create it.

    For more information about opening test units if you decide not to enable this option, see Opening a test unit.

  5. Enable the Show Server Context Overlay always check box if you want to always have the Server Context Overlay enabled.

    For more information about the Server Context Overlay, see Using the Server Context Overlay.

  6. Click OK.

Creating a test project

Do the following to create a test project to store the individual test units you will create:

  1. Select File > New > Integrated Test Environment Project from the menu bar.
  2. At the "New Integrated Test Environment Project" screen, type a name for the test project in the Project name field.

    Project names can only contain alphanumeric characters and underscores, and must be specified in English.

  3. To have the folder for the library created in the default location (your workspace) and with a name identical to the name specified for the library, leave the Use default location check box enabled.

    If you want to specify the name and location of the library folder, do the following:

    1. Clear the Use default location check box.
    2. Type the full path and name of the directory that you want to use for the library in the Location field, or click Browse to select an existing directory.
    Note:
    There is no way to create the folder for a library in the path of the workspace other than to let System Manager do it by use of the Use default location check box.

    Figure 74 shows the "New Integrated Test Environment Project" wizard.

    Figure 74. Creating a new WBI ITE project


  4. Click Finish.

    The project is created and a folder is added for it to the "Integrated Test Environment Navigator" view.

Creating test units

A test unit is the workbench resource that contains the configuration information for a test you want to perform. You can either create a test unit from within Integrated Test Environment, or from within System Manager.

If you have the Open the new test unit in the editor upon creation check box enabled in the Integrated Test Environment preferences, then the test unit opens after you create it. If you do not have this preference enabled then you must open the test unit using the instructions in Opening a test unit. For more information on Integrated Test Environment preferences, see Configuring test project preferences.

Creating a test unit within Integrated Test Environment

Do the following to create a test unit within Integrated Test Environment:

  1. Select File > New > Integrated Test Environment Test Unit from the menu bar.
  2. At the "Select Collaboration" screen, select the collaboration object you want to test from the list of all the collaboration objects in all the integration component libraries defined in the system.

    Figure 75 shows the "Select Collaboration" screen.

    Figure 75. Selecting a collaboration to test


  3. Click Next.
  4. At the "Create Integrated Test Environment Test Unit" screen, do the following:
    1. Type a name for the test unit in the Test Unit field.
    2. Select the test project in which the test unit should be created from the ITE Project drop-down menu.

    Figure 76 shows the "Create Integrated Test Environment Test Unit" screen.

    Figure 76. Specifying the test unit name and project


  5. Click Finish.

Creating a test unit within System Manager

Do the following to create a test unit from within System Manager:

  1. Create a test project to contain the test unit as described in Creating a test project.
  2. Right-click the collaboration object that represents the interface and select Debug in Integrated Test Environment from the context menu.
  3. At the "Create Integrated Test Environment Test Unit" screen, type a name for the test unit in the Test Unit field, and select the test project it should be created in from the ITE Project drop-down menu.

    Figure 76 shows the "Create Integrated Test Environment Test Unit" screen.

  4. Click Finish.

Opening a test unit

Once you have created a test unit you can open it to view its layout and configure it. Do the following to open a test unit:

  1. Expand the test project that contains the test unit in the "Integrated Test Environment Navigator" view.
  2. Do one of the following to open a test unit:

    The test unit opens, displaying a representation of the collaboration object in the Test Unit editor and populating the views of the perspective with information specific to the interface. Figure 71 shows the appearance of the Integrated Test Environment perspective after you have opened a test unit.

Copyright IBM Corp. 1997, 2004