{"id":15013968,"url":"https://github.com/apideck-libraries/postman-to-k6","last_synced_at":"2025-05-15T11:07:20.210Z","repository":{"id":37723935,"uuid":"396255951","full_name":"apideck-libraries/postman-to-k6","owner":"apideck-libraries","description":"Converts Postman collections to k6 script code","archived":false,"fork":false,"pushed_at":"2024-11-15T17:38:15.000Z","size":4588,"stargazers_count":249,"open_issues_count":11,"forks_count":25,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-04-14T18:09:30.307Z","etag":null,"topics":["k6","k6-converter","load-testing","performance-testing","postman","postman-collection"],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/@apideck/postman-to-k6","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/apideck-libraries.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-08-15T07:11:59.000Z","updated_at":"2025-04-13T08:03:06.000Z","dependencies_parsed_at":"2024-03-06T17:02:56.204Z","dependency_job_id":"f8e3e38a-2853-42ed-859c-e894130e2469","html_url":"https://github.com/apideck-libraries/postman-to-k6","commit_stats":{"total_commits":699,"total_committers":21,"mean_commits":"33.285714285714285","dds":"0.31902718168812594","last_synced_commit":"28bacfac676f689d4018fb87e96f37bebb3402d6"},"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apideck-libraries%2Fpostman-to-k6","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apideck-libraries%2Fpostman-to-k6/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apideck-libraries%2Fpostman-to-k6/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apideck-libraries%2Fpostman-to-k6/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apideck-libraries","download_url":"https://codeload.github.com/apideck-libraries/postman-to-k6/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248933340,"owners_count":21185460,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["k6","k6-converter","load-testing","performance-testing","postman","postman-collection"],"created_at":"2024-09-24T19:45:00.743Z","updated_at":"2025-04-14T18:09:41.868Z","avatar_url":"https://github.com/apideck-libraries.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n![postman-to-k6-cover](./assets/postman-to-k6-cover.png)\n\n\u003c/div\u003e\n\n# Postman-to-k6\n\nConverts a [Postman collection](https://www.getpostman.com/docs/collections) to a [k6 script](https://docs.k6.io/docs).\n\nThe postman-to-k6 converter utilizes your Postman collection and converts all the Postman requests, including tests,\nvariables, ... to K6 scripts that can be executed by K6 to run performance tests.\n\n![Github badge](https://github.com/apideck-libraries/postman-to-k6/actions/workflows/build-on-tag.yml/badge.svg)\n\u003ca href=\"https://www.npmjs.com/package/@apideck/postman-to-k6\" alt=\"Latest Stable Version\"\u003e![npm](https://img.shields.io/npm/v/@apideck/postman-to-k6.svg)\u003c/a\u003e\n\u003ca href=\"https://www.npmjs.com/package/@apideck/postman-to-k6\" alt=\"Total Downloads\"\u003e![npm](https://img.shields.io/npm/dw/@apideck/postman-to-k6.svg)\u003c/a\u003e\n\nThis project is a friendly fork of the original [grafana/postman-to-k6](https://github.com/grafana/postman-to-k6)\nconverter, actively maintained and open for new contributions.\n\nFeel free to contribute or pass any suggestion to improve postman-to-k6.\n\n## Content\n\n- [Features](#features)\n- [Installation](#installation)\n    - [Local Installation (recommended)](#local-installation-recommended)\n    - [Global Installation](#global-installation)\n- [Usage](#usage)\n- [Video introduction](#video-introduction)\n- [Options](#options)\n    - [Iterations](#iterations)\n    - [Environment Variables](#environment-variables)\n    - [Global Variables](#global-variables)\n    - [CSV Data File](#csv-data-file)\n    - [JSON Data File](#json-data-file)\n    - [K6 Param Options File](#k6-param-options-file)\n    - [K6 Handle Summary as JSON](#k6-handle-summary-as-json)\n    - [K6 Request tag](#k6-request-tag)\n    - [Separate](#separate)\n    - [Skip Pre](#skip-pre)\n    - [Skip Post](#skip-post)\n    - [CLI options file](#cli-options-file)\n- [Examples](#examples)\n- [Unsupported Features](#unsupported-features)\n- [Other similar tools](#other-similar-tools)\n- [Credits](#credits)\n\n## Features\n\n- [x] Pre-request scripts.\n- [x] Test scripts.\n- [x] Variables (at all scopes + dynamic).\n- [x] Data files.\n- [x] Authentication methods (except Hawk).\n- [x] File uploads (experimental).\n- [x] `postman.*` interface ([exceptions below](#unsupported-features)).\n- [x] `pm.*` interface ([exceptions below](#unsupported-features)).\n- [x] Support for\n  Postman [Dynamic Variables](https://learning.postman.com/docs/writing-scripts/script-references/variables-list/)\n  \u0026 [ReplaceIn](https://learning.postman.com/docs/writing-scripts/script-references/postman-sandbox-api-reference/#using-variables-in-scripts)\n  function.\n- [x] Global variables exposed by Postman: `globals` `environment` `data`\n  `iteration`.\n- [x] `xml2Json` conversion.\n- [x] All [Postman Schema](https://schema.getpostman.com/) versions.\n\n## Installation\n\n### Local Installation (recommended)\n\nWhile possible to install globally, we recommend that you, if possible, add the converter to the `node_modules` of your\ntest project using:\n\n```shell\n$ npm install -D @apideck/postman-to-k6\n```\n\nor using yarn...\n\n```shell\n$ yarn add @apideck/postman-to-k6\n```\n\nNote that this will require you to run the converter with `npx @apideck/postman-to-k6 your-postman-file` or, if you are\nusing an older versions of npm, `./node_modules/.bin/postman-to-k6 your-postman-file`.\n\n### Global Installation\n\n```shell\n$ npm install -g @apideck/postman-to-k6\n```\n\n## Usage\n\nTo convert an exported collection to a k6 script:\n\n```shell\n$ postman-to-k6 collection.json -o k6-script.js\n```\n\nThen run the script in k6, as usual, using:\n\n```shell\n$ k6 run k6-script.js\n```\n\n## Video Introduction\n\nTogether with [Nicole van der Hoeven](https://twitter.com/n_vanderhoeven) \u0026 [Paul Balogh](https://twitter.com/javaducky) from the [K6 team](https://www.youtube.com/@k6io), we talked about \"[postman-to-k6](https://github.com/apideck-libraries/postman-to-k6)\" in the [K6 Office Hours](http://www.youtube.com/watch?v=Be66Db4wHLA) podcast. We talked about how to convert a Postman collection to a k6 load test, the advantages of Postman, and the benefits of reusing automation testing scripts for performance.\n\n\u003ca href=\"https://www.youtube.com/watch?v=Be66Db4wHLA\" target=\"_blank\" title=\"Postman for load testing using k6, with Tim Haselaars (k6 Office Hours #43)\" rel=\"nofollow\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/apideck-libraries/postman-to-k6/main/assets/youtube-still.png\" alt=\"Postman for load testing using k6, with Tim Haselaars (k6 Office Hours #43)\" width=\"50%\"\u003e\u003c/a\u003e\n\nWatch it on Youtube \u003e\u003e https://www.youtube.com/watch?v=Be66Db4wHLA\n\nTopics covered:\n* Use cases for [k6](https://k6.io/)\n* Quick tour of [Postman](https://www.postman.com/)\n* Why Postman is not designed for load testing\n* Demo of [postman-to-k6](https://github.com/apideck-libraries/postman-to-k6)\n* How to use [Portman](https://blog.apideck.com/announcing-portman) to generate tests from an OpenAPI spec\n\n## Options\n\n### Iterations\n\nConfigures how many times the script will be executed before completion.\n\n| Flag | Verbose        | Default |\n| ---- | -------------- | ------: |\n| `-i` | `--iterations` |       1 |\n\nExample:\n\n```shell\n$ postman-to-k6 collection.json --iterations 25 -o k6-script.js\n```\n\n### Environment Variables\n\nProvide environment variables from a JSON file.\n\n| Flag | Verbose         | Default |\n| ---- | --------------- | ------- |\n| `-e` | `--environment` | N/A     |\n\nExample:\n\n```shell\n$ postman-to-k6 collection.json --environment environment.json -o k6-script.js\n```\n\n### Global Variables\n\nProvide global variables from a JSON file.\n\n| Flag | Verbose    | Default |\n| ---- | ---------- | ------- |\n| `-g` | `--global` | N/A     |\n\n```shell\n$ postman-to-k6 collection.json --global globals.json -o k6-script.js\n```\n\n### CSV Data File\n\nProvide a data file in the CSV format.\n\n| Flag | Verbose | Default |\n| ---- | ------- | ------- |\n| `-c` | `--csv` | N/A     |\n\n```shell\n$ postman-to-k6 collection.json --csv data.csv -o k6-script.js\n```\n\n### JSON Data File\n\nPass in a data file in the JSON format.\n\n| Flag | Verbose  | Default |\n| ---- | -------- | ------- |\n| `-j` | `--json` | N/A     |\n\n```shell\n$ postman-to-k6 collection.json --json data.json -o k6-script.js\n```\n\n### K6 Param Options File\n\nPass [K6 parameter options](https://k6.io/docs/javascript-api/k6-http/params) as a file in JSON format.\n\n| Flag | Verbose       | Default |\n| ---- | ------------- | ------- |\n|      | `--k6-params` | N/A     |\n\n```shell\n$ postman-to-k6 collection.json --k6-params k6-params.json -o k6-script.js\n```\n\n### K6 Handle Summary as JSON\n\nOutput the [K6 summary](https://k6.io/docs/results-visualization/end-of-test-summary/#handlesummary-callback) as a file\nin JSON format. This will add the K6 `handleSummary(data)` to the generated script, providing the functionality that K6\nwill store the summary output as JSON file locally.\n\n| Flag | Verbose                    | Default |\n| ---- | -------------------------- | ------- |\n|      | `--k6-handle-summary-json` | N/A     |\n\n```shell\n$ postman-to-k6 collection.json --k6-handle-summary-json summary-report.json -o k6-script.js\n```\n\n### K6 Request tag\n\nGenerate [K6 request name tags](https://k6.io/docs/using-k6/http-requests/#http-request-tags) based on available naming\nstrategies:\n\n- none: no automatic generated tags | default\n- `request`: uses the request name as tag (example \"Show all accounts\")\n- `folder-request`: uses Postman folder name and the request name (example: \"Accounts - Show all accounts\")\n\n| Flag | Verbose                | Default |\n| ---- | ---------------------- | ------- |\n|      | `--k6-request-tagging` | N/A     |\n\nExample for `request` strategy\n\n```shell\n$ postman-to-k6 collection.json --k6-request-tagging=request -o k6-script.js\n```\n\nExample for `folder-request` strategy\n\n```shell\n$ postman-to-k6 collection.json --k6-request-tagging=folder-request -o k6-script.js\n```\n\n### Separate\n\nSplit requests into separate files, for easier rearrangement of the logic.\n\n| Flag | Verbose      | Default |\n| ---- | ------------ | ------- |\n| `-s` | `--separate` | false   |\n\n```shell\n$ postman-to-k6 collection.json --separate -o k6-script.js\n```\n\n```shell\n$ postman-to-k6 collection.json -s -o k6-script.js\n```\n\n### Skip Pre\n\nSkips any pre-request scripts during conversion\n\n| Flag | Verbose      | Default |\n| ---- | ------------ | ------- |\n|      | `--skip-pre` | false   |\n\n```shell\n$ postman-to-k6 collection.json --skip-pre -o k6-script.js\n```\n\n### Skip Post\n\nSkips any post-request scripts during conversion\n\n| Flag | Verbose       | Default |\n| ---- | ------------- | ------- |\n|      | `--skip-post` | false   |\n\n```shell\n$ postman-to-k6 collection.json --skip-pre -o k6-script.js\n```\n\n### CLI options file\n\nManage all the CLI options in a separate configuration file and pass them along to the postman-to-k6 command. To make\nthe CLI usage easier, especially in CI/CD implementations.\n\nAll the available CLI options can be used in the config file. By passing the CLI options as parameters, you can\noverwrite the defined CLI options defined in the file.\n\n| Flag | Verbose              | Default |\n| ---- | -------------------- | ------- |\n|      | `--cli-options-file` | false   |\n\n```shell\n$ postman-to-k6 collection.json --cli-options-file cli-config.json\n```\n\nExample of JSON CLI config file\n\n```json\n{\n    \"output\": \"k6-script.js\",\n    \"k6-params\": \"config/k6-params.json\",\n    \"environment\": \"config/envs/team.env.json\",\n    \"separate\": true\n}\n```\n\n## Examples\n\nA collection of Postman examples are located under `example`. To run one of the examples, just run it as you would any\nother command:\n\n```shell\n$ postman-to-k6 example/v2/echo.json -o k6-script.js\n```\n\n## Unsupported Features\n\n- Sending requests from scripts using `pm.sendRequest`.\n- Controlling request execution order using [`postman.setNextRequest`](https://github.com/apideck-libraries/postman-to-k6/discussions/135#discussioncomment-10229573).\n- Cookie properties, like `hostOnly`, `session`, and `storeId`.\n- Postman methods:\n    - `pm.response.reason`\n    - `pm.response.to.have.status(reason)`\n    - `pm.response.to.not.have.status(reason)`\n    - `pm.request.auth`\n- The Hawk authentication method.\n- Deprecated `xmlToJson` method.\n- Request IDs are changed. Postman doesn't provide them in the export, so we have to generate new ones.\n\n## Resources\nA collection of blog posts and resources about postman-to-k6\n- [k6 Office Hours #43](https://www.youtube.com/watch?v=Be66Db4wHLA) Podcast by [Grafana/K6](https://k6.io/) \u0026 Tim Haselaars (maintainer of [postman-to-k6](https://github.com/apideck-libraries/postman-to-k6))\n- [Load testing your API with Postman](https://grafana.com/blog/2020/04/19/load-testing-your-api-with-postman/) by [Mostafa Moradian](https://grafana.com/author/mostafa-moradian/) from [Grafana](https://grafana.com/)\n- [Unlocking the Power of Spec-Driven API Development](https://www.youtube.com/watch?v=YXRstde1SeA\u0026t) by [Tim Haselaars](https://github.com/thim81)\n- [API load testing: A beginner's guide](https://grafana.com/blog/2024/01/30/api-load-testing/) by [Grafana/K6](https://k6.io/)\n- [Charge your APIs Volume 6: Perfecting Your APIOps - Harnessing the Power of k6 for API Testing](https://www.codecentric.de/wissens-hub/blog/charge-your-apis-volume-6-perfecting-your-apiops-harnessing-the-power-of-k6-for-api-testing) by [Daniel Kocot](https://www.linkedin.com/in/danielkocot/) from [Codecentric](https://www.codecentric.de/)\n- [Load Testing with Postman and Grafana K6](https://medium.com/kpmg-uk-engineering/load-testing-with-postman-and-grafana-k6-48afb4872a6b) by [Lukman Patel](https://medium.com/@patel.s.lukman?source=post_page-----48afb4872a6b--------------------------------)\n- [Shift left performance test by converting Postman API script to K6 and integrate it with bitbucket](https://icehousecorp.com/shift-left-performance-test-by-converting-postman-api-script-to-k6-and-integrate-it-with-bitbucket/) by sukma ragil\n- [Hacker News](https://news.ycombinator.com/item?id=36540241)\n- [Transformando testes de API com Postman em testes de performance com K6](https://dev.to/marlo2222/transformando-testes-de-api-com-postman-em-testes-de-performance-com-k6-3ked) by [Marlo Henrique](https://dev.to/marlo2222)\n- [Converting Postman Collection to K6 Script](https://blog.nashtechglobal.com/converting-postman-collection-to-k6-script/)\n- [Using Postman with k6](https://medium.com/@rianaik/using-postman-with-k6-6cb4c5852990) by [RiaNaik](https://medium.com/@rianaik)\n- [Postman to K6 Automating Performance Testing with Auto Script Generation](https://www.youtube.com/watch?v=e0QdBoWS72k) by [Huzaifa Asif](https://www.youtube.com/@huzaifa-io)\n- [Postman to k6 in under 5 minutes](https://medium.com/@t79877005/postman-to-k6-in-under-5-minutes-fb98fabaf468) / [YouTube](https://www.youtube.com/watch?v=ddP4HcFfXRw) by [loan Solderea](https://www.linkedin.com/in/%F0%9F%95%B5ioan-s-b0928516/)\n\n## Other similar tools\n\n- [jmeter-to-k6](https://github.com/loadimpact/jmeter-to-k6/): Convert JMeter JMX files to k6 JS.\n\n## Credits\n\nSpecial thanks to the K6 team from [Grafana](https://github.com/grafana) for open-sourcing \u0026 growing the\nconverter and contributing it to the community. Thanks to [bookmoons](https://github.com/bookmoons) for creating this\ntool. Also, thanks to [borjacampina](https://github.com/borjacampina) for creating the original incarnation of the tool.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapideck-libraries%2Fpostman-to-k6","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapideck-libraries%2Fpostman-to-k6","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapideck-libraries%2Fpostman-to-k6/lists"}