-
When using Newman and CLI to run functional tests for my collections I call Postman's API for my collections and environments. Is there an easy way to do this when running the npx script to generate the k6-script.js file? I tried something like this but no luck: npx @apideck/postman-to-k6 https://api.getpostman.com/collections/XXX?apikey=XXX --environment https://api.getpostman.com/environments/XXX?apikey=XXX -o k6-script.js |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @w100frt The postman-to-k6 CLI expects the files to be on your local file system to be able to process them. You could use a very simple shell script to download the Postman collection and Postman Environment as files upfront, which next can be be passed along. #!/bin/bash
# Postman API references
API_KEY=<YOUR-POSTMAN-API-KEY>
COLLECTION_UUID=<YOUR-POSTMAN-COLLECTION-UUID>
ENVIRONMENT_UUID=<YOUR-POSTMAN-ENVIRONMENT-UUID>
# Download Postman Collection
curl --header "X-Api-Key: $API_KEY" -s "https://api.getpostman.com/collections/$COLLECTION_UUID" -o postman_collection.json
# Download Postman Environment
curl --header "X-Api-Key: $API_KEY" -s "https://api.getpostman.com/environments/$ENVIRONMENT_UUID" -o postman_environment.json |
Beta Was this translation helpful? Give feedback.
Hi @w100frt
The postman-to-k6 CLI expects the files to be on your local file system to be able to process them.
We deliberate did not included operations to download the Postman collection to keep the scope of the CLI focussed on the conversion.
You could use a very simple shell script to download the Postman collection and Postman Environment as files upfront, which next can be be passed along.