Create new test categories, test sets, and object types
We can create new test categories, new test sets in an existing category, and new subsets in an existing test set. We can also define new object types for which we want to create tests.
All of the tests that are supplied with IBM MQ Explorer are grouped in the Queue manager tests category. In the Queue manager tests category, each test is associated with a specific test set; for example, Queues or Channels. The test sets are used to make the default selections in the Run Tests dialog, which is based on the type of folder or object in the Navigator view from which you opened the Run Tests dialog. The test sets are also used to specify which tests are run in the default set of tests.
We can see these categories and test sets if you open the Run Tests dialog (right-click a folder in the Navigator view, then click Tests > Run custom test configuration) and look at one of the test configurations on the Tests page of the dialog.
We can create new categories (like the Queue manager tests category). We can also create new test sets (like the Queues test set) in a category, and even new subsets in an existing test set.
If you create new object types and folders to display in the Navigator view of IBM MQ Explorer and we want to create tests that verify definitions of the new object types, we can define the new object types so that they are displayed as options on the Objects page of the Run Tests dialog.
For instructions on creating new tests in an existing test set in the Queue manager tests category, see Create a new test. The following instructions describe how to create new categories and test sets, and define new object types:- Create a new test set in an existing category (com.ibm.mq.explorer.tests.Testset)
- Create a new category and test set (com.ibm.mq.explorer.tests.TestCategorys)
- Defining a new object type to be tested (com.ibm.mq.explorer.tests.ContextGroup)
Do the following tasks in the Plug-in Development perspective.
Parent topic: Adding new testsCreate a new test set in an existing category (com.ibm.mq.explorer.tests.Testset)
About this task
To create a new test set in an existing category (a category that you did not create; for example the Queue manager tests category):
Procedure
- On the Extensions page of the plugin.xml file, add the com.ibm.mq.explorer.tests.Testset extension to the All Extensions pane.
- Configure the new test set according to the details in
the following table:
Attribute Description Example value categoryId The unique identifier of the category in which we are creating the new test set. com.ibm.mq.explorer.tests.coretests.wmq id The unique identifier of the category that we are creating. com.ibm.mq.explorer.tests.samples.NewCategory name A meaningful name for the category. My New Category description A brief description of the category. This is my first new category. icon An optional icon that can be used to represent the category. icons/newcat.gif (The location of the icon file relative to the plugin.xml file.) 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 you double-click the test in the Run Tests dialog or a test result in the Test Results view. doc/MyObject.html (The location of the HTML or XHTML file relative to the plugin.xml file.) - Save the plugin.xml file.
Results
We have created a new test set in an existing category.
Create a new category and test set (com.ibm.mq.explorer.tests.TestCategorys)
About this task
If we are creating a new category, we can create test sets in that category by using a single extension; that is, you do not need to use the separate com.ibm.mq.explorer.tests.Testset extension as well.
To create a new category:
Procedure
- On the Extensions page of the plugin.xml file, add the com.ibm.mq.explorer.tests.TestCategorys extension to the All Extensions pane.
- Configure the new category according to the details in
the following table:
Attribute Description Example value id The unique identifier of the category that we are creating. com.ibm.mq.explorer.tests.samples.NewCategory name A meaningful name for the category. My New Category description A brief description of the category. This is my first new category. icon An optional icon that can be used to represent the category. icons/newcat.gif (The location of the icon file relative to the plugin.xml file.) 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 you double-click the test in the Run Tests dialog or a test result in the Test Results view. doc/MyObject.html (The location of the HTML or XHTML file relative to the plugin.xml file.) - Save the plugin.xml file.
Results
We have created a new category.
What to do next
To create a new test set in this category:
- Right-click the category, then click New > testset to add a new test set to the All Extensions pane.
- Configure the new test set according to the details in the table in Create a new test set in an existing category. Notice that we do not set a categoryID attribute because we are creating the test set in the category that you just created.
- Save the plugin.xml file.
We have created a new test set in the new category.
Defining a new object type to be tested (com.ibm.mq.explorer.tests.ContextGroup)
About this task
If we have created new types of objects to be displayed in the Navigator view of IBM MQ Explorer and we want to create tests to check definitions of the new object types, we must define the object types by using an com.ibm.mq.explorer.tests.ContextGroup extension. This extension displays a new high-level group in the Run Tests dialog on the Objects page at the level of the supplied Queue Managers, Clusters, and Queue Sharing Groups groups.
To define a new object type:
Procedure
- On the Extensions page of the plugin.xml file, add the com.ibm.mq.explorer.tests.ContextGroup extension to the All Extensions pane.
- Configure the new group according to the details in the
following table:
Attribute Description Example value groupId The unique identifier of the group that we are creating. com.ibm.mq.explorer.tests.samples.NewGroup name A meaningful name for the group. My New Group description A brief description of the group. This is my first new group. We have defined the new group. Next, define the criteria that is used to identify which group an object belongs to.
- In the All Extensions pane, right-click
the group, select New, and then select the
type of criteria to use according to the information in the following
table:
Criteria type Description Example value instanceOf The object must use an instance of a specific fully qualified class. com.ibm.mq.explorer.clusterplugin.internal.objects.ClusterObject objectType The object's objectType attribute must have a specific value. We can also specify whether the value must match the criteria exactly. com.ibm.mq.explorer.queuemanager objectId The object's objectId attribute must have a specific value. We can also specify whether the value must match the criteria exactly. com.ibm.mq.explorer.queuemanager - Save the plugin.xml file.
Results
We have defined the new group of objects for which you can run tests.