JMS (Java Message Service) is a widely used messaging standard in enterprise applications for inter-system communication. These messaging systems are scalable and reliable but require load testing to ensure optimal performance and scalability. Apache JMeter, a popular open-source load testing tool, provides extensive support for testing JMS messaging systems. In this blog post, we will explore how to test JMS messaging systems using JMeter, including creating a new Test Plan, adding a Thread Group, adding a JMS Point-to-Point Sampler, and adding assertions to validate the response received from the messaging system.
Table of contents
- Prerequisites
- Start the ActiveMQ server
- Log in to the ActiveMQ server
- Create a JMeter test plan for ActiveMQ
- Add Assertions to the JMeter test plan
- Add Listeners to the JMeter test plan
- Run the test plan and analyze the results
- Conclusion
Prerequisites
Before we start testing JMS messaging systems with JMeter, we need to ensure that we have the following prerequisites:
JMeter: Please refer to our previous article to learn How to Install JMeter on Windows and Mac.
JMS messaging system: To demonstrate JMS testing with JMeter, we will use ActiveMQ, a robust open-source message broker that implements the JMS specification and supports various messaging protocols. ActiveMQ is free and can be downloaded from ActiveMQ’s official website.
The Apache Software Foundation developed ActiveMQ, and it is a widely used message-oriented middleware offering message persistence, clustering, and high availability. Its ease of use and powerful features make it a popular choice for implementing JMS-based messaging systems.
JMeter Plugins Manager: To use the JMS Point-to-Point Request sampler we refer to in this article, you must install the JMeter Plugins Manager, which includes JMS-related samplers and much more.
To check if it’s installed, click the Options menu in JMeter. If you see a Plugins Manager option, skip to the next section. Otherwise, follow the instructions in this Plugins Manager document to get it set up.
ActiveMQ JAR file: Since JMeter does not include an ActiveMQ JAR file by default, one must be downloaded in order for JMeter to communicate with the ActiveMQ messaging system. Follow the following steps to do that:
- Download the activemq-all.jar ZIP file from this link.
- Unzip the file and copy the activemq-all.jar file into your JMeter
lib/ext
folder. - Re-start JMeter if necessary.
Now that we have the prerequisites, let us dive into the step-by-step guide to test JMS messaging systems with JMeter.
Start the ActiveMQ server
Refer to the ActiveMQ official documentation to learn how to start the server on your system.
Log in to the ActiveMQ server
Once the server is up and running, follow these steps to log in to the server:
Step 1: Got to http://localhost:8161/admin/
Step 2: If prompted for a username and password, you may use admin, which is the default value for both.
Step 3: Click on the Queues tab. Your screen should now look as follows:

Create a JMeter test plan for ActiveMQ
Step 1: Add Thread Group
We need to add a Thread Group to the Test Plan. A Thread Group defines the number of users and the load test duration. To create a Thread Group in your Test Plan, right-click on the Test Plan, select Add, choose Threads (Users), and then Thread Group from the dropdown menu.

Give a name to the Thread Group (optional) and set the number of users and other test parameters shown below.

We will be doing the following in this JMeter test:
- Simulate 10 users (threads), each sending a single JMS message.
- All messages will have been sent within 3 seconds (ramp-up period).
- The actions will only be done once (loop count = 1).
Step 2: Add JMS Point-to-Point Sampler
We will use a JMS Point-to-Point Sampler to communicate with ActiveMQ. To add a JMS Point-to-Point Sampler, you can follow these steps:
- Right-click on the Thread Group and select Add from the context menu.
- Choose Sampler and select JMS Point-to-Point from the dropdown menu.

Step 3: Configure ActiveMQ with JMS Point-to-Point Sampler
In the JMS Point-to-Point Sampler, provide the following details:
QueueConnection Factory: ConnectionFactory
JNDI name Request queue: {your queue name}
JNDI name Receive queue: {same queue name as above}
Message properties:
- request_reply selected
- Use Request Message Id checked
- Use Response Message Id checked
- Timeout (ms) = 2000
- Priority = a number between 0 and 9, with zero being a low priority and nine a high priority.
Content: Enter the message body that you would like to be sent to the destination queue (in ActiveMQ).
Initial Context Factory: org.apache.activemq.jndi.ActiveMQInitialContextFactory
JNDI Properties:
- Name = queue.{your queue name}
- Value = {an arbitrary name}
Provider URL: tcp://localhost:61616

Save the Test Plan and run it to send the JMS message.
Visit the official JMeter documentation to learn more about each of the parameters in a JMS Point-to-Point sampler.
Add Assertions to the JMeter test plan
It’s always a good idea to add assertions in your tests. These assertions can check if the response contains specific text, matches a regular expression, or has a particular response code. Let’s add one to validate the response received from the messaging system.
To add an assertion, right-click on the JMS Point-to-Point Sampler > Add > Assertions > Response Assertion. We will use this assertion to verify that “automateNow!” is returned in the response.
Do the following in the Response Assertion:
- Apply to: Main sample only
- Field to Test: Text Response
- Pattern Matching Rules: Contains
- Patterns to Test: click Add and enter the text that you expect to receive in the response
- Custom failure message (optional): enter the error message that JMeter should show when the assertion fails
Your screen should resemble the following:

Add Listeners to the JMeter test plan
Let us now add a test listener so that we can view the test results.
- Right-click the test group > Add > Listener > View Results Tree
Your Tree View in JMeter should look as follows:

Run the test plan and analyze the results
You can run the test once you have configured the JMS Point-to-Point Sampler. To run the test, click the green play button. JMeter will start sending JMS requests to the messaging system (ActiveMQ), and we can monitor the results by selecting the View Results Tree listener in JMeter:

The green check marks indicate that all our test assertions passed. If you see red Xs, it means that the test assertions failed. Please review the steps in this article carefully to ensure you didn’t miss anything.
Pro Tip:
Add a Summary Report listener to see average response time, throughput, standard deviation, error rates, and more as you run the test using varying numbers of threads and ramp-up periods in the Thread Group.
Now, let’s see the ActiveMQ server:
Refresh the server’s webpage to see the messages that you just sent to it. Your screen should look as follows:

If you’re seeing the messages on the server, congratulations! Please comment below if you run into any issues, and we will do our best to help.
Final thoughts on testing JMS messaging systems with JMeter
JMeter’s support for JMS messaging systems makes it an essential tool for any software tester who deals with message-based applications. With JMeter, we can simulate real-world scenarios, which helps identify potential issues and improve the application’s overall quality.
When testing JMS messaging systems, we can use different samplers based on our requirements. Each sampler type has its configuration options that can be customized to meet the testing requirements. JMeter supports Point-to-Point, Publisher/Subscriber, and Request/Reply samplers, among others.
One of the key benefits of using JMeter for testing JMS messaging systems is the ability to perform stress testing. Stress testing helps determine the maximum load the messaging system can handle before it degrades in performance. By running stress tests with JMeter, we can identify the bottlenecks and optimize the messaging system to handle the expected load.
Another benefit of using JMeter for testing JMS messaging systems is the ability to perform spike testing. Spike testing helps identify how the messaging system responds to sudden spikes in traffic. By simulating sudden spikes in traffic with JMeter, we can determine the messaging system’s ability to handle unexpected traffic and make necessary improvements to avoid downtime.
JMeter is a versatile and powerful tool for load-testing JMS messaging systems. By using JMeter to test JMS messaging systems, we can ensure that the application performs optimally, providing a better user experience and improving the overall quality. With JMeter, we can easily create and execute load tests on JMS messaging systems and get valuable insights into the performance and scalability of the messaging system.
This post is part of our comprehensive JMeter Mini-Course.
Follow our blog
Be the first to know when we publish new content.