IBM MQ and JMeter: First Contact
Hi, Habr!
This is a prequel of my previous publication and at the same time a remake of the article Automated testing of services using the MQ protocol using JMeter .
This time, I’ll talk about my experience of reconciling JMeter and IBM MQ for happy testing applications on IBM WAS. Faced such a task, she did not easily give in. I want to help save time for all interested.

About the project: data bus, multiple xml messages, three exchange areas (queues, databases, file system), web services with their own message processing logic. As the project progressed, testing by hand became increasingly difficult. Apache JMeter was called to help - powerful and open source, with a large user community and user-friendly interface. The ease of customization of the "out of the box" version allows you to cover any cases, and the promise of the lead developer to help if that (did help) is finally approved in the selection.
To interact with the queue manager, you need an initial context. It is of several types, here you can read more.
It is convenient to use MQ Explorer to create it:

Figure 1: Adding an initial context
Select the context file type and directory for storing the .bindings file that will contain the description of the JNDI objects:

Figure 2: Select the initial context type
Then you can start creating these objects. And start with the connection factory:

Figure 3: Create a connection factory
Choose a friendly name ...

Figure 4: Select the name of the connection factory
... and type Queue Connection Factory :

Figure 5: Selecting the connection factory type
Protocol - MQ Client for interfacing with MQ remotely:

Figure 6: Selecting the connection factory protocol
In the next step, you can select an existing factory and copy further settings from it. Click Next if there is none:

Figure 7: Selecting the settings of an existing connection factory
In the parameter selection window, it is enough to set three. On the Connection tab, specify the name of the queue manager and stand ip with its location ( leave port 1414 ):

Figure 8: Configuring the parameters of the connection factory
AND On the Channels tab - the channel for the connection. Click Finishto complete:

Figure 9: Completing the creation of the connection factory
Now let's create a connection to the queue:

Figure 10: Create the target object
Choose a friendly name (I prefer to specify the real name of the queue) and type Queue :

Figure 11: Select the name and type of the target object
Similar to Figure 7 You can copy settings from an existing queue. Also click Next if it is the first:

Figure 12: Select settings for an existing target
In the settings window, just select the name of the manager and the desired queue, click Finish . After that, repeat the required number of times until all the queues necessary for interacting with JMeter are created:

Figure 13: Completing the creation of the target object
Preparing JMeter is to add the libraries necessary to interact with MQ. They are located in% wmq_home% / java / lib. Copy them to% jmeter_home% / lib / ext before running JMeter.
An alternative list suggested by polarnik in a comment with a slight nuance: javax.jms-api-2.0.jar instead of jms.jar.
With jms.jar, the error NoClassDEfFoundError occurs, the solution of which is found here .
Both library lists work successfully with JMeter 5.0 and IBM MQ 8.0.0.4.
The necessary and sufficient set of JMeter elements looks like this:

Figure 14: Test plan
In the example test plan there are five variables. Despite the small number of them, I recommend having separate configuration elements for different types of variables. As the test grows, this will greatly simplify navigation. In this case, there are two lists. The first one contains MQ connection parameters (see Figure 2 and Figure 4 ):

Figure 15: MQ connection parameters The
second is the names of targets that refer to queues:

Figure 16: Parameterized queue names
It remains to configure JMS Publisher to load the test message to the outgoing queue :

Figure 17: Configuring JMS Publisher
And JMS Subscriber to read the message from the incoming queue:

Figure 18: Configuring JMS Subscriber
If everything is done correctly, the result of the execution in the list will be filled with bright and cheerful green colors.
Intentionally lowered the issues of routing and administration, it is quite intimate and extensive topics for individual publications.
In addition, there is a solid portion of the nuances in working with queues, databases and files, which I would also like to talk about separately and thoroughly.
Take care of your time. And thank you for your attention.

This is a prequel of my previous publication and at the same time a remake of the article Automated testing of services using the MQ protocol using JMeter .
This time, I’ll talk about my experience of reconciling JMeter and IBM MQ for happy testing applications on IBM WAS. Faced such a task, she did not easily give in. I want to help save time for all interested.

Introduction
About the project: data bus, multiple xml messages, three exchange areas (queues, databases, file system), web services with their own message processing logic. As the project progressed, testing by hand became increasingly difficult. Apache JMeter was called to help - powerful and open source, with a large user community and user-friendly interface. The ease of customization of the "out of the box" version allows you to cover any cases, and the promise of the lead developer to help if that (did help) is finally approved in the selection.
Preparing the initial context
To interact with the queue manager, you need an initial context. It is of several types, here you can read more.
It is convenient to use MQ Explorer to create it:

Figure 1: Adding an initial context
Select the context file type and directory for storing the .bindings file that will contain the description of the JNDI objects:

Figure 2: Select the initial context type
Then you can start creating these objects. And start with the connection factory:

Figure 3: Create a connection factory
Choose a friendly name ...

Figure 4: Select the name of the connection factory
... and type Queue Connection Factory :

Figure 5: Selecting the connection factory type
Protocol - MQ Client for interfacing with MQ remotely:

Figure 6: Selecting the connection factory protocol
In the next step, you can select an existing factory and copy further settings from it. Click Next if there is none:

Figure 7: Selecting the settings of an existing connection factory
In the parameter selection window, it is enough to set three. On the Connection tab, specify the name of the queue manager and stand ip with its location ( leave port 1414 ):

Figure 8: Configuring the parameters of the connection factory
AND On the Channels tab - the channel for the connection. Click Finishto complete:

Figure 9: Completing the creation of the connection factory
Now let's create a connection to the queue:

Figure 10: Create the target object
Choose a friendly name (I prefer to specify the real name of the queue) and type Queue :

Figure 11: Select the name and type of the target object
Similar to Figure 7 You can copy settings from an existing queue. Also click Next if it is the first:

Figure 12: Select settings for an existing target
In the settings window, just select the name of the manager and the desired queue, click Finish . After that, repeat the required number of times until all the queues necessary for interacting with JMeter are created:

Figure 13: Completing the creation of the target object
JMeter preparation
Preparing JMeter is to add the libraries necessary to interact with MQ. They are located in% wmq_home% / java / lib. Copy them to% jmeter_home% / lib / ext before running JMeter.
- com.ibm.mq.commonservices.jar
- com.ibm.mq.headers.jar
- com.ibm.mq.jar
- com.ibm.mq.jmqi.jar
- com.ibm.mq.pcf.jar
- com.ibm.mqjms.jar
- dhbcore.jar
- fscontext.jar
- jms.jar
- jta.jar
- providerutil.jar
An alternative list suggested by polarnik in a comment with a slight nuance: javax.jms-api-2.0.jar instead of jms.jar.
With jms.jar, the error NoClassDEfFoundError occurs, the solution of which is found here .
- com.ibm.mq.allclient.jar
- fscontext.jar
- javax.jms-api-2.0.jar
- providerutil.jar
Both library lists work successfully with JMeter 5.0 and IBM MQ 8.0.0.4.
Setting up a test plan
The necessary and sufficient set of JMeter elements looks like this:

Figure 14: Test plan
In the example test plan there are five variables. Despite the small number of them, I recommend having separate configuration elements for different types of variables. As the test grows, this will greatly simplify navigation. In this case, there are two lists. The first one contains MQ connection parameters (see Figure 2 and Figure 4 ):

Figure 15: MQ connection parameters The
second is the names of targets that refer to queues:

Figure 16: Parameterized queue names
It remains to configure JMS Publisher to load the test message to the outgoing queue :

Figure 17: Configuring JMS Publisher
And JMS Subscriber to read the message from the incoming queue:

Figure 18: Configuring JMS Subscriber
If everything is done correctly, the result of the execution in the list will be filled with bright and cheerful green colors.
Conclusion
Intentionally lowered the issues of routing and administration, it is quite intimate and extensive topics for individual publications.
In addition, there is a solid portion of the nuances in working with queues, databases and files, which I would also like to talk about separately and thoroughly.
Take care of your time. And thank you for your attention.
