Creating a new test

We can create a new test to add to an existing category and set of tests.


These instructions describe how to create a new test in an existing category and set of tests (for example, the Queues test set in the Queue manager tests category) in IBM MQ Explorer. The instructions explain how to define the test in the Eclipse development environment. For information about writing the Java test source, see the WMQTest interface.

If you want to create a new set or category of tests instead of using an existing set or category, or if we have created new objects to administer in IBM MQ Explorer and you are writing tests for the new objects, see Creating new test categories, test sets, and object types.


Creating an Eclipse plug-in project to contain the new test

Before you begin

Ensure that we have installed the Eclipse Graphical Editing Framework (GEF) tools. For more information, see Install into Eclipse environments.

About this task

Create and configure a new plug-in project to contain your new test:

Procedure

  1. Open the Plug-in Development perspective.
  2. In the Package Explorer view, right-click, then click New > Plug-in Project. The New Plug-in Project wizard opens.
  3. In the Project name field, type a name for the project that contains your new tests.
  4. Click Next.
  5. Edit the details in the Version, the Name, and the Vendor fields, and then click Finish.

    Note the value in the ID field can be different from the value that you entered in the Name field on the previous page of the wizard. The project name is used only during development; the plugin ID is used by Eclipse to load and identify the plugin.

    The new plug-in project is displayed in the Package Explorer view and the plug-in manifest file is automatically opened.
  6. In the Plug-in Manifest editor, click the Dependencies tab. Two dependencies are already listed in the Required Plug-ins pane.
  7. Add the following plug-ins to the Required Plug-ins pane:

    • com.ibm.mq.explorer.tests
    • com.ibm.mq.explorer.ui
    • com.ibm.mq.pcf.event
    • com.ibm.mq.runtime
    • org.eclipse.core.resources

    If the listed plug-ins are not available, install the Eclipse Graphical Editing Framework (GEF) tools. For more information, see Install into Eclipse environments.

  8. Save the MANIFEST.MF file.

Results

The plug-in project is ready to contain tests


Defining a new test

About this task

The following instructions describe how to define a new test an existing test set (for example, in the Queues test set), in the existing Queue manager tests category. For more information about creating new test sets in the Queue manager tests category, creating new categories, or defining new object types to be tested, see Creating new categories, test sets, and object types.

Configure your plug-in to contain a new test:

Procedure

  1. Ensure that the plugin.xml or MANIFEST.MF file is open in the Plug-in Manifest editor.
  2. In the Plug-in Manifest editor, click the Extensions tab to display the Extensions page.
  3. Click Add.... The New Extension wizard opens.
  4. Highlight the com.ibm.mq.explorer.tests.Tests extension point, then click Finish. The new tests extension is added to the All Extensions pane in the Plug-in Manifest editor.
  5. Click the new test to highlight it, then enter the test's details as shown in the following table:
    Attribute Description Example value
    id The unique identifier of the test. com.ibm.mq.explorer.tests.samples.QueueNames
    name The meaningful name of the test. My Queues Test
    class The Java class that contains the test. Do not enter this value yet; we can automatically enter this value when you create the class later. com.ibm.mq.explorer.tests.samples.QueueNames
    testset The category to which the test belongs. The example value shown associates the test with the category Queue manager tests. com.ibm.mq.explorer.tests.samples.wmq
    testsubset The subcategory to which the test belongs. The example value shown associates the test with the subcategory Queues. queues
    description A description of what the test checks. Checks queue names against simple naming conventions.
    furtherinfo The location of an HTML or XHTML document that contains more information about the test. This document is displayed in IBM MQ Explorer when we double-click the test in the Run Tests dialog or a test result in the Test Results view. For more information, see Test Documentation doc/QueueNamesInfo.html (The location of the file relative to the plugin.xml file.)
  6. Save the Plug-in Manifest editor file.

Results

The plug-in project is now configured to contain a new test; next you need to write the test itself.

Define a new test for each new test to write.


Writing a new test

About this task

Create a new Java class that contains the test:

Procedure

  1. In the Extension Element Details pane, click the label of the class field, which is underlined. The Java Attribute Editor wizard opens.
  2. Ensure that only the Inherited abstract methods check box is selected, then click Finish. The Java class file opens in the Java editor.
  3. Save the Plug-in Manifest editor file. Notice that the value in the class field is automatically inserted.
  4. Edit the Java source.
  5. Document the test in a valid XHTML or HTML file. Save the file with the name and location that is specified in furtherinfo attribute in the plugin.xml file. The location of the XHTML file might be local (stored in the same plug-in as the test; for example, in a doc subfolder) or remote (stored on a web server).

Results

You have completed writing the test and configuring the plugin that contains the test. Next, export the plug-in and deploy the plug-in to test it.

Write a new test for each test that you defined in the plugin.xml file.


Deploying the new test

About this task

Export the plug-in that contains your test (or set of tests) to the file system then restart IBM MQ Explorer so that the new plug-in is loaded and we can run the tests:

Procedure

  1. In the Package Explorer view, right-click the plugin project, com.ibm.mq.explorer.tests.samples, then click Export.... The Export... dialog opens.
  2. In the Plug-in Development perspective, click Deployable plug-ins and fragments to highlight it, then click Next.
  3. In Directory field, enter the location of the IBM MQ Explorer Tests plugin. The location is MQ_INSTALLATION_PATH\eclipse, where MQ_INSTALLATION_PATH represents the high-level directory in which IBM MQ is installed.
  4. Select your plug-in in Available Plug-ins and Fragments, and then click Finish.
  5. Restart Eclipse, and switch to the IBM MQ Explorer perspective.

Results

You have deployed your new plugin. Now we can run your new tests.