In the previous article of this series, we learned how to create a Postman collection from our OpenAPI documentation.
Check out the complete series if you missed it!
Today we will see in this brief tutorial how to create a Jmeter test suite from our collection using Loadium
Our test suite will be generated from the Postman collection in the previous chapter. We have all the CRUD functionality of our Idea API if you remember.
Let's export our collection into JSON.
Right clickon the collection
Collection v2.1 (recommended)
- Click again on
It will require you to log in. You could use Google, Github, or Linkedin for doing so, so no worries! After the login process, the home section will appear. Select
Convert to .JMX option, the last one on the left.
When the form pop-up appears, select the default option
POSTMAN. Then drag your exported collection file to the drop zone. Now your file will be successfully generated. Click in
To install Jmeter, you should follow these steps provided by this Blazemeter article
Install the most recent 64-bit Java Runtime Environment (JRE) or Java Development Kit (JDK). Because JMeter is a pure Java program, this is critical.
Go to the Apache JMeter website and look for the Binary to save to your PC.
Move this file to your desired location after downloading it. Unpack it, then go to the folder, then the bin directory.
Take a peek around. A set of scripts should appear that can run JMeter in various modes.
For me, I have to run on my Ubuntu terminal
and the GUI will appear before my 👀👀
Don't be afraid of the installation process. Is quite easy although it is not very frequent
Now we are only a few steps from the glory! 🥳🥳
Let's add our JMX file by selecting
Open and navigate to the location of your downloaded JMX file.
Now you should see the testing suite loaded in JMeter
We have to make some refactoring to make it work. If you click on one of the requests, you would see something like this:
We have to make the following changes:
- Split the baseUrl into Protocol - Host - Port
- Refactor the :ideaId parameter into JMX Syntax
First, we will add some basic variables for configuration. To include a config element, let's right click on the engine wheel and select
Config Element ->
User Defined Variables
We will include two elements:
- defaultPath: the prefix path for requests ->
- server: the domain of our mock server ->
We want to configure the HTTP server once and inherit it on each request. To do so, we have to create an HTTP Request Defaults element by right-clicking on the engine wheel and selecting
Config Element ->
We have to add the server variable. Left the port empty as we are using the 89. It results as follows:
We have to refactor the ideaId parameter so that it fits the Jmeter syntax. You can click on
Search or the shortcut
Ctrl+F. The search panel will appear.
Now all we have to do is to change all the
Let's include an example ideaId value to our user variables. We could add it dynamically using JSON assertions, but it is out of the scope of the tutorial. If you want more info about it, check this article.
The resultant User variables would be:
Finally, we have to add the defaultPath variable to each of the requests (I know, this is a heavy con 🥲🥲). If you find out any alternative, please let me know in the comments!
We have our requests but, HOW THE HECK WE KNOW THEY ARE WORKING AS EXPECTED !?!?!?
Let's add some assertions to the requests.
- Right Click on any of the requests and select
- Select the Response Code and add the value
- Change the
Pattern Matching Rulesto
You can copy and paste the assertion to all the requests by doing
Ctrl+C to the element, selecting the target request, and
Finally, we have to add a listener to the end of the suite to have a summary of the results of our testing process.
Click on the engine and select
Listener and add both
View Results Tree and
These two are the ones I use the most for testing myself. One will show you the data of the requests/response, very useful for debugging. The other one will show you the results of your assertions. The results tree would show anything different from a 2XX code as an error, but you may want to test error cases. That's when the
Assertion results come in handy.
Now we are ready to test! 🥳🥳
We didn't make a single line of code, remember. So, have to use the mock server we created in a previous article. For using it we have to set up the HTTP Request options to:
- Protocol: HTTPS
- Server: domain of your mock server. In my case ``
- Port: Empty or 80. It's the same.
Let's launch it!! Go and click on the RUN button in the toolbar.
You should check your assertions and see EVERYTHING IS GREEN 💚 (Mock's magic 🪄🪄)
And that's it! You have created a test suite for your API design!
I know there are some alternatives like Newman which I have to test yet. But I find Jmeter to be very complete, as we have additional options, out of the scope of the article like:
- Checking DB rows
- Checking Redis/Cache status with custom Beanshell scripts
- JSON Assertions
- Way other things I don't know 😁😁
In this article, I hope you have learned:
- Convert your Postman collection to a JMeter file using Loadium
- Install Jmeter
- Configure a Jmeter file and add assertions
- Execute a Test Suite in Jmeter
I am HONOURED if you have reached this point. Thanks a lot for reading 💙
Hopefully, I was able to explain how to create a Jmeter test file from a Postman, configure, and run it!
Reach out on Twitter to find more valuable content or just chatting!
Thanks and Keep It Up! 🦾🦾