svanoort / pyresttest

Python Rest Testing
Apache License 2.0
1.15k stars 325 forks source link

Getting variable binds from a file #226

Open hardyarora opened 7 years ago

hardyarora commented 7 years ago

Is it possible to get variable_binds from a file?

mmadsen commented 7 years ago

There seems to be a command line argument for this (--vars) but there is no documentation on how the binding works in the test configurations, or what exact format is expected in the YAML for variables passed to --vars. Is this ready for use, or still in progress? This is exactly what is needed for having one set of test configurations that can be used easily across multiple deployment stages (dev, staging, production).

magthe commented 6 years ago

It's apparently supposed to be a YAML dictionary, but nothing I've tried is accepted. It would be nice with an example using this.

snigdhitha commented 6 years ago

I need to pass some dynamic variables to the YAML file through cli. I do not understand how to do it.

joseph-cloudthing commented 6 years ago

Looking at the source it seems to use yaml.safe_load() and so you'd pass it a string, not a file?

I'm using something like this, where $adminpassword is set as an environment variable.

--vars="{\"adminpassword\": \"$adminpassword\"}"