Reputation: 4733
There are two variables defined for my test. I want to set these values through the CI.
Below is the code from gitlab-ci.yml
smoketest-test:
stage: smoketests-test
dependencies:
- deploy-test
image:
name: postman/newman:alpine
# entrypoint: [""]
script:
- newman --version.sh
- npm install -g newman-reporter-html
- newman runs tests/postmanui-tests.json -e tests/${ENV_VAR}_environment.json "uname" = "abc"
artifacts:
when: always
paths:
- report.html
only:
- master
except:
- schedules
tags:
- environment_test
How can I pass the variable "uname" value from the CI? Currently it is not being passed through.
Upvotes: 2
Views: 1049
Reputation: 879
Individual variables can be overridden with the --env-var
flag.
To hardcode the values:
- newman run tests/postmanui-tests.json -e tests/${ENV_VAR}_environment.json --env-var uname="abc"
To use Gitlab CI variables:
variables:
uname: default-value
abc: default-value
...
- newman run tests/postmanui-tests.json -e tests/${ENV_VAR}_environment.json --env-var ${uname}=${abc}
Upvotes: 2