Importing Postman collection to jMeter

mati-qa
4 min readSep 7, 2023

--

Intro

Let’s imagine, we have a bunch of collections created in postman — that was the easiest tool for us, and we used it as a smoke tests. We already tried some fee stuff in postman, but it seems that is not enough for us. Or we just need to try, how our endpoint will behave when we ‘stress’ them a bit. BTW. during my ride with the Postman, I experienced a lot of out of memory exception (including the Newman tool). So, yeah… Let’s try jMeter.

What we would need: both tools need to be installed — we are going to invoke requests via Postman (each request as a single or using test run) and then gathering the request in a jMeter. In that way, we’ll import / migrate Postman collections (requests) to the jMeter Thread Group.

Configuration

To acquire our goal, we need to configure both tools to be able to communicate.

jMeter configuration

The following stuff needs to be added:

  1. Create a new jMeter project or use an existing one (doesn’t matter at that moment — actually it depends on how organized you would like to have your projects)
  2. Add new Thread Group
  3. Add a Recording controller — right-click on the Thread group > Add > Logic Controller > Recording Controller (as on the screen below)

4. Then we need to add HTTP(S) Test Script Recorder — right-click on the Test plan > Add > Non-Test Elements > HTTP(S) Test Script Recorder

Now, the most interesting part is this HTTP(S) Test Script Recorder at the moment. As there we could leave all as defaults, but before we’ll start invoking requests from the Postman, we need to hit the ‘Start’ button.

Postman configuration

Now, it’s time for Postman. Actually, we can assume, that all collections are already there (are loaded and ready to use). In that case, we just need to configure Postman proxy. To do that, you need to click on the ‘Settings’ icon > Proxy (in the left menu) and then ‘Use custom proxy configuration’ option. Here is the screen, which explains where to find it:

There we have to inputs in Proxy server:

  • first — IP
  • second — Port

What to put there? If we go back, to the last screen from jMeter — we can see there, Global Settings section and Port inside — which be default is set to 8888. And this is the value which should be set in Postman as port. But what IP? The easiest way to check what IP should be put there is — open command line and using one of the following command check the IP (depends on the OS):

  • ifconfig (Linux, macOS, WSL)
  • ipconfig (Windows)

BTW. If you’re using jMeter started from WSL command line under your Windows machine — you should type this command in a new WSL command line window. As WSL is using different IP then the Host (Windows).

Action

Let’s do the magic now.

  1. So, proxy in Postman is configured.
  2. Collection is opened in the test runner.
  3. jMeter is prepared — hit the ‘Start’ button (in jMeter > HTTP(S) Test Script Recorder) and in a new (small window) type the name of the requests — you can modify it later, so no worries.
  4. Back to the Postman — run the collection
  5. After collection run will be finished, we can click on the Stop button in jMeter recording pop-up.
  6. That’s it. Collection is imported and available in the jMeter — ready to use.

Notice that — at this point, all random variables which were configured and used in Postman — will not work after that migration. As we kinda record the requests which Postman triggers by the jMeter — the whole randomization needs to be again made in jMeter.

Conclusion

Few simple steps, and the fan of Postman, can start its journey with jMeter — much more powerful, fully free tool. There are couple negatives of that migration:

  • all randomization which was made in Postman is gone in jMeter after migration
  • all logic — e.g. parameters passing between the requests in Postman is gone
  • all tests — also gone — needs to be written again using jMeter stuff

Besides of that, you can easily start performance tests against the API, which you called using Postman collections. How awesome is that!! :D

--

--

No responses yet