Converts Postman collections to k6 script code
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
examples/postman
lib
.gitignore
.npmignore
CHANGELOG.md
README.md
index.js
package.json

README.md

Postman-to-k6

Converts a Postman collections to k6 script.

The transformer converts Postman requests and variables into k6 requests and variables respectively.

Postman pre-requests and tests are appended as comments before and after its respective k6 request. The pre-request and test behaviour could easily be replicated with the K6 API.

## Installation and usage

As npm global package:

npm install -g postman-to-k6
postman-to-k6 postman-collection.json -o k6-script.js
k6 run k6-script.js

As local repository:

git clone git@github.com:loadimpact/postman-to-k6.git
cd postman-to-k6
npm install

#On macOS, Linux, or OpenBSD
bin/postman-to-k6.js examples/postman/v2/echo.json -o k6-script.js

#On windows
node bin/postman-to-loadimpact.js examples/postman/v2/echo.json

k6 run k6-script.js

Options

The transformer provides a command line interface with different options.

  Usage: postman-to-k6 <filePath> [options]

  Convert a Postman collection to k6 script

  Options:

    -h, --help                    output usage information
    -V, --version                 output the version number
    -j --input-version <version>  Input version. Options `2.0.0` or `1.0.0`. Default `2.0.0`.
    -o --output <path>            Target file path where the converted collection will be written. Default `console`

Examples

A collection of Postman examples are located under ./examples/postman.

The k6 script will be auto-generated when running:

$ postman-to-k6 examples/postman/v2/echo.json - o k6-script.js

Please, use the issue tracker to open a discussion or bug report.

Credits

Thanks to borjacampina for creating this tool.