Basic Postman Example
Below is a simple workflow for executing a Postman collection stored on GitHub. You can paste this directly into the
YAML of an existing or new test, just make sure to update the name
and namespace
for your environment as needed.
- The
spec.content
property defines the path to the postman collection in a GitHub repository - the
spec.steps
property defines a single step that runs the collection with the newman Docker image
Basic Postman Workflow
kind: TestWorkflow
apiVersion: testworkflows.testkube.io/v1
metadata:
name: postman-sample
namespace: testkube
labels:
docs: example
spec:
content:
git:
uri: https://github.com/kubeshop/testkube
revision: main
paths:
- test/postman/executor-tests/postman-executor-smoke-without-envs.postman_collection.json
container:
workingDir: /data/repo/test/postman/executor-tests
resources:
requests:
cpu: 256m
memory: 128Mi
steps:
- name: Run test
run:
image: postman/newman:6-alpine
args:
- run
- postman-executor-smoke-without-envs.postman_collection.json
After execution, you can see the log output from the test executions under the executions panel tabs:
Basic Postman from Template
Below is an example workflow for executing the Postman collection using an official Testkube Template.
Basic Postman Workflow from Template
apiVersion: testworkflows.testkube.io/v1
kind: TestWorkflow
metadata:
name: postman-sample-from-template
namespace: testkube
labels:
docs: example
spec:
content:
git:
uri: https://github.com/kubeshop/testkube
revision: main
paths:
- test/postman/executor-tests/postman-executor-smoke.postman_collection.json
container:
workingDir: /data/repo/test/postman/executor-tests
steps:
- name: Run from
template:
name: official/postman/v1
config:
run: "newman run postman-executor-smoke.postman_collection.json --env-var TESTKUBE_POSTMAN_PARAM=TESTKUBE_POSTMAN_PARAM_value"
note
Please visit YouTube to watch our video on how to Simplify API Testing in Kubernetes with Postman and Testkube: