Use Rational Integration Tester to test WebSphere MQ test message transactions
An introduction to using the integration testing tool included in IBM Rational Test Workbench
Scope of this article
IBM® Rational® Integration Tester is part of the IBM® Rational® Test Workbench , which combines the capabilities of functional, performance, regression, load, and integration testing automated testing of highly complex applications. This introduction covers only the setup to test message transactions within IBM® WebSphere® MQ. It gives an overview of only one aspect of Rational Integration Tester, and there are more ways that you can use it for integration testing.
You need to have the following software installed on a Microsoft Windows operating system:
- Rational Integration Tester Version 8.0. To install this, you need to download, IBM Rational Test Workbench Setup and IBM Rational Integration Tester from IBM Passport Advantage (see "Get products" in Related topics for a link).
- IBM WebSphere MQ Version 7.0.
Set up Rational Integration Tester to work with WebSphere MQ
To use IBM WebSphere MQ with Rational Integration Tester, you need to configure the libraries in Rational Integration Tester Library Manager.
Configure the libraries
- Select Programs > IBM Rational Integration Tester > Library Manager (set-up).
- Select IBM WebSphere MQ in the left pane.
- Select an appropriate provider in the right pane.
A red cross for a version in the right pane indicates that the required Java archive (JAR) files are not available for that version.
Figure 1. Library Manager
Based on the version of IBM WebSphere MQ, the corresponding libraries (JAR files) should be configured. These JAR files are available where IBM WebSphere MQ server is installed. You might have to copy these files to your local system to configure. In that case, you can copy the files to a directory of your choice, and then click the Browse button to direct Library Manager to that directory.
Create a Queue Manager and Queue
You will be recording MQ messages from a queue, so create a Queue Manager and then a queue within it.
- Select Programs > IBM WebSphere MQ > WebSphere MQ Explorer.
Figure 2. IBM WebSphere MQ Explorer
- Right-click Queue Managers to create a new Queue Manager.
- Click the default Queue Manager to make it the default manager.
Notice that default queues are created in the default Queue Manager.
- To create a new queue, right-click Queues under the Queue Manager in the left pane.
- Select New > Queue > Local Queue.
- Provide a name for the queue, for example, Test_MQ.
- Proceed through the default settings, and then click Finish.
You will see the queue added in the right pane.
Rational Integration Tester can use a concept called proxy queuing to record transactions from live applications. When proxy queues are used, additional queues must be created to match the application queues. For example, Queue1 and the matching proxy queue, either Queue1.GH or Queue1.proxy. Proxy queues can have any extension or prefix but .GH or .proxy extensions are the usual ones.
Prepare for recording
The default WebSphere MQ recording method is Queue Browsing. It does not require any special setup, but it might miss messages in an active queue because it polls. Mirror Queues, Dynamic Mirror Queues, Queue Aliasing, and Proxy Queues are alternative recording methods that require configuration of API exits. The section that follows explains that procedure.
Configure API exits
For recording the entire Queue Manager or individual queues using the Mirror Queue recording mode, Rational Integration Tester requires API exits to be deployed. These exits are included. You need administrative access to the Queue Manager to deploy them. Follow these steps to continue installation:
- Install the API exit file.
- From the Rational Integration Tester installation directory (usually C:\Program Files\IBM\RationalIntegrationTester\), navigate to the tools\IBM\MQ\7.0 directory, which contains intercepts (the files with .dll extensions). There are 32-bit and 64-bit specific .dll files.
- Copy the .dll files to the Exits directory in the WebSphere MQ
installation. For example:
- Windows 32-bit API exit: <IBM WebSphere MQ Installation Directory>\exits\
- Windows 64-bit API exit: <IBM WebSphere MQ Installation Directory>\exits64\
- Configure the Queue Manager to use the exits:
- In the IBM WebSphere MQ Explorer, right-click the relevant Queue Manager and select Properties.
- In the Properties wizard, select Exits in the left pane to display the Exits configuration in the right pane. The window shows the default location of the exits.
- On the Exits page, click the Add button to display the Add API Exit dialog window.
Figure 3. API exit configuration wizard
- In the Edit AP Exit dialog window, add the values to configure the
Queue Manager for exits:
- In the Name field, enter Intercept.
- In the Function field, enter EntryPoint.
- For the Module field, click Browse button, navigate to the exits directory within the WebSphere MQ installation directory, and select the appropriate file to enter (usually C:\Program Files\IBM\WebSphere MQ\exits\intercept_windows_x86_7.0.dll).
- Select the Data check box.
- In the Data field, type com.greenhat.intercept.
- Click OK to close the Add API Exit dialog window.
- On the Exits page, click Apply.
- Click OK to close the Properties wizard.
- Restart the Queue Manager from the WebSphere MQ Explorer wizard to deploy the specified API exit file on the selected Queue Manager.
Create a project in Rational Integration Tester
After WebSphere MQ is configured, you can test it.
- To create a project in Rational Integration Tester, select Programs > IBM Rational Integration Tester.
- Select New Project, and click OK to open the New Project wizard.
Figure 4. Rational Integration Tester New Project wizard
- Provide the project name, and click Finish.
The Logical View in the Architecture School Perspective usually opens by default.
Figure 5. Create New Project wizard
The logical view in the Architecture School perspective shown in Figure 7 usually opens by default.
Set up the recording environment
You need to set up a test environment needs for Rational Integration Tester so that resources can be used according to the requirements of the project.
- Create an environment for the test.
- In Rational Integration Tester, select Project >
Create New Environment.
Figure 6. Create New Environment wizard
- Provide a name for the environment (for example, RITTestEnv), and click OK.
- Click OK again in the next window to create the environment.
- In Rational Integration Tester, select Project > Create New Environment.
- Add a Queue Manager.
- In the logical view of the Architectural School perspective,
right-click and select New > IBM > IBM WebSphere
MQ Queue Manager.
Figure 7. Architectural School perspective in Rational Integration Tester
- Provide a name for the Queue Manager, such as RITandMQ, and
click OK. The Queue Manager is added in the logical view
Figure 8. Enter a name for the new Queue Manager
- Select the Physical view tab at the bottom of the Architecture School view.
- Select IBM > IBM WebSphere MQ Queue Manager.
- In the logical view of the Architectural School perspective, right-click and select New > IBM > IBM WebSphere MQ Queue Manager.
- Create an IBM WebSphere MQ Queue Manager Transport.
A WebSphere MQ Queue Manager transport can be created by creating a physical Queue Manager resource in the Architecture School view of Rational Integration Tester.
Figure 9. Physical View tab within the Architecture School view
Configure transport message settings
Following any one of the previous steps takes you to the wizard shown in Figure 10 to configure the transport message settings so that messages can be recorded, published, or subscribed from a queue within the configured Queue Manager.
Figure 10. Transport Message Settings dialog window
- Provide the host name and the name of the Queue Manager, and click the Test Transport button. If the details are correct, the transport test result should be successful.
- In the Recording Tab of the transport, define the mode of recording. The physical connection needs to be bound to the logical component. Go back to the Logical View, right-click the Queue Manager that you added, and select Set Binding in > your project > physical Queue Manager name (where words in italic depend on your previous choices).
Figure 11. Binding the physical connection to the logical component
You can use Rational Integration Tester to record messages either for an operation or on a transport, so follow the steps under following two sections, based on your requirements.
Set up to record an operation
In the logical view, establish the service components and operations that are associated with the IBM WebSphere MQ. These operations are definitions of your application functions.
- Create a service container to hold the operations.
- Right-click the logical view of the Architectural School view.
- Select New > General > Service.
- Create a service operation.
- Right-click the logical view of the Architectural School view.
- Select New > General > Operation.
Figure 12. Add an operation in the logical view
- Define your operation and how it interacts with WebSphere MQ queues by double-clicking the operation.
For example, for a Publish operation, you can provide the queue that you must publish to in order to trigger that operation. The other settings are optional in this case.
Figure 13. Publish operation properties configuration
WebSphere MQ messaging uses various pairing mechanisms to pair a Publish and Subscribe or a Send and Receive reply pair. This matching and pairing is done with message identifiers in the message header, such as Correlation ID and Message ID. This mechanism of pairing should mimic the similar mechanism used by the application under test.
Queues and Queue Managers defined for operations and stubs would be used when tests, stubs, and so forth are created from the message exchange pattern of the operations. When the recording is used for creating tests and stubs, WebSphere MQ traffic information is used rather these definitions.
- In the Recording Studio, click the plus (+) sign to add service operations that can be monitored for WebSphere MQ recording. These operations are the application interfaces that interact with WebSphere MQ, as defined in the logical view of the Architecture School view.
Figure 14. Selecting operation resource for recording
Set up to record the whole transport
In WebSphere MQ Version 7 and later, you can record all MQ traffic of the Queue Manager.
After you have created the transport as mentioned in the Set up the recording environment section, go to the Recording Studio, click the + sign to add the transport that can be monitored for WebSphere MQ recording.
Figure 15. Select the resource for recording
Record the messages
In the Recording Studio view, click the round red Start Recording icon to record transactions.
Figure 16. Recording Studio view
Recorded transactions display in the Event View window.
Figure 17. Recording Studio showing messages (events)
The recorded events can be exported to be used later by clicking on the Export Event Selected button.
Figure 18. Exporting the recorded events
Similarly, test cases, test data, and stubs can be created based on the recorded transactions by clicking the test data and stub creation icons in the toolbar.
Figure 19. Stubs creation from the recorded events
The test creation wizard assists in creating these items and allows necessary modifications to be applied to the recorded data. The screen in Figure 20 highlights the wizard where a schema can be applied to the recorded messages.
Figure 20. Modification of the recorded events
Run the test
The newly created test looks like the Test Factory view in Figure 21.
Figure 21. Test Factory view
When you click the green Run icon with the arrow or click F5, the test will execute.
Figure 22. Test execution from the Test Factory View
You can view the results of a test in the Test Lab view.
Figure 23. Test Lab view
Troubleshoot if necessary
If an error message such as the one shown below appears during test execution, make sure that the IBM WebSphere MQ Queue Manager is up and running. Go to Architecture School and Physical view to verify that the settings for physical transport are appropriate and that Test Transport works correctly.
Publish: "MQ Message" on queue "QUEUE1" using schema "MQ Message" via "TestMQ" (2) Fatal Error: Cannot publish as the transport "IBMTest- MQ Queue Manager IBMTest@SQUEUE1.GH@IBMTest." is not available. (Error resolving host "test.ibm.com": test.ibm.com)
- Download Rational Test Workbench, which includes Rational Integration Tester, from Passport Advantage. Registration and sales representative assistance required for access to 30-day free trial.
- Download a free trial version of Rational software.
- Evaluate IBM software.