Skip to content

postman-solutions-eng/postman-jmeter

Repository files navigation

NOTE: This utility is based on the work of sercheo87.

⚠️ CAUTION: ⚠️ We are writing results files back to the repo in our workflows, which is an absolute NO-NO in any production app. But, this is a hack, so it's OK. However, to avoid unnecessary git-related lulz, please fork this repo and use your fork for demos.

postman-jmeter

This tool convert projects Postman to JMeter

Installation

npm i postman-jmeter -g

Usage

$ postman-jmeter
Usage: convert-postman-jmeter -p [file] -j [file] [-o] [-b] [-v=resolve|transform] 
-help Show help boolean
--version Show version boolean
-p, --postman Path of postman collection file to process file required
-j, --jmeter Path of JMeter test plan (.jmx) file required
-e, --environment Path of postman environment file string optional
-o, --overwrite Overwrite existing .jmx file boolean optional
-v, --variables Variable resolution strategy string required transform, resolve
-b, --batch Process all collection files (*.postman_collection.json) in directory boolean optional
-k, --postmanAPIKey Postman API Key. Consider using an environment variable locally and a secret in your CI/CD system string required
-w, --workspaceID UID for workspace to report test results back to. Only useful in CI/CD context string optional

Variable Resolution Strategy

Postman collection and environment variables are added to the JMeter Test Plan as User Defined Variables. What appears in the value column in the User Defined Variables pane and other parts of the JMeter UI depends on the variable resolution strategy.

How to handle variables defined at the collection and environment level.

  • resolve: Resolve postman variables into their actual values in the JMX test plan. Replace references to variables with their actual variables elsewhere, eg in the protocol, Server Name or IP, and/or Path fields:

image

image

  • transform: Resolve values in the User Defined Variables pane, but use JMeter replacement syntax elsewhere.

image

resolve is the default strategy.

Automation with GitHub Actions

This utility is designed to enable load-testing via JMeter as part of a CI/CD pipeline. An example can be found in this repo.

NOTE: Protocol is always resolved, even if inferred from variable values.

Reporting results back to Postman

If desired, test results in the form of a screenshot of the JMeter HTML report can be sent back to a workspace in Postman. See t ./github/workflows/load-testing-image.yml for an example.

Limitations

Body data are not currently processed.

Known Issues

For issues create o find in issues page.