Seamlessly integrate your Postman Collections with Gatling for advanced load testing

2 min read
Dec 12, 2024 8:15:00 AM

Postman is an excellent tool for functional API testing, ensuring your endpoints respond correctly and meet expectations under normal conditions. However, real-world usage often involves far greater demands than what functional tests simulate. That’s where load testing becomes essential. 

With the Gatling-Postman integration, you can seamlessly reuse your Postman collections as the foundation for advanced load tests, without any complex conversions or extra steps. Unlike traditional converters, our integration uses your Postman Collections as they are—no need for tedious format changes. Make updates to your collections, export them, and you’re ready to go.

The integration is now live and available to all JavaScript & TypeScript users, offering full-scale load testing capabilities on Gatling Enterprise!

Prerequisites

Step 1: Export your Postman Collection

In your Postman workspace navigate to the collections menu and press the ellipsis button. At the bottom of the menu select the export option. Export your collection as a v2.1. This downloads a JSON file to your machine.

 

Step 2: Setup a Gatling JavaScript Project

If you don't already have a Gatling JavaScript Project, head to the open-source downloads page for your free copy:

Unzip the Gating JavaScript project and open it in your favorite IDE. The SDK has JavaScript and TypeScript folders. You can use either, but we will focus on JavaScript for the rest of this post.

  • Add your Postman collection to the javascript/resources folder Gatling JavaScript project
  • Open the javascript/src folder and create a file named postman.gatling.js.
  • In the newly created file add the following JavaScript code:
import { simulation, constantUsersPerSec } from "@gatling.io/core";
import { http } from "@gatling.io/http"; 
import { postman } from "@gatling.io/postman";

export default simulation((setUp) => {
  const httpProtocol = http;

  const collection = postman
    .fromResource("yourCollectionName.postman_collection.json");


  const scn = collection.scenario("My Scenario", { pauses: 1 });
  
  setUp(
    scn.injectOpen(
        constantUsersPerSec(1).during(60)
    ).protocols(httpProtocol)
 ); 
});
  • Change yourCollectionName on line 9 to match the filename for your imported Postman collection.
  • Run the installation command to install all of the packages and dependencies:
npm install --save "@gatling.io/postman"

 

Step 3: Run your test on Gatling Enterprise

Remove the Open-source test limits by running your test on Gatling Enterprise with a free trial account. To do so:

  1. Package your test by running the command npx gatling enterprise-package in your terminal. The packaged simulation is saved in the target folder.
  2. Log in to your Gatling Enterprise account.
  3. Click on Simulations in the left-side menu.
  4. Click on Create a simulation and follow the prompts to upload your package and create your simulation.
  5. Start your simulation and see the live results!

 

What’s next?

This first Postman-Gatling integration opens up new opportunities for efficient API testing workflows. By linking functional tests with performance insights, you can streamline your development process and deliver faster, more reliable APIs.

Our team plans to release additional functionalities including direct connections between your Postman Cloud account and Gatling Enterprise.

Get the latest news on our Postman integrations: