Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing in variables mentioned nowhere in documentation #305

Open
joegfutrli opened this issue Jul 19, 2019 · 1 comment
Open

Passing in variables mentioned nowhere in documentation #305

joegfutrli opened this issue Jul 19, 2019 · 1 comment

Comments

@joegfutrli
Copy link

I was struggling for a while to work out how i could pass variables from outside my yaml, in to pyresttest, almost concluding it could not be done as it is mentioned nowhere in any of your documentation.

It took running pyresttest --help in CLI to find you could do this:

pyresttest [URL] [file] --vars='{"key": "value"}'

This lets you use $key in your yaml to pass in your value, allowing you to use the same file for lots of different test cases.

Adding this as an issue in the hopes no one else will lose a day to this.

@SebaRossi94
Copy link

Hey there i was able to do this exactly as you said but when i tried to use this inside a bash script it can't be done.
Here is the bash:

printf "input user:"
read USER
printf "input pass"
read -s PASS
vars="'{\"USERNAME\": \"$USER\", \"PASSWORD\": \"$PASS\"}'"
pyresttest url test.yaml --vars $vars

and the yaml file:
- body: {template: 'username=$USERNAME&password=$PASSWORD'}

If i do pyresttest url test.yaml --vars '{"USERNAME": "user", "PASSWORD": "pass"}' on cmd it works perfectly
I don't know what am i doing wrong here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants