Skip to content

Converts Postman collections to k6 script code

Notifications You must be signed in to change notification settings

lwouis/postman-to-k6

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 [email protected]: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.

About

Converts Postman collections to k6 script code

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%