cdent / gabbi

Declarative HTTP Testing for Python and anything else
http://gabbi.readthedocs.org/
Other
148 stars 34 forks source link

Save environment variables to temporary file for future usage #268

Closed taget closed 5 years ago

taget commented 5 years ago

Hello Actually this may be a requirement instead of a issue.

I have an API service (which is not RESTful, some of them looks like create, return a task id then , query the task id to get previous task's status.

I have each API test in one yaml file(so I have some yaml files) , what I want to do is I would like to write some bash scripts to make some test scenario by call each yaml file (several api calls), but it seems no way to share variables between each gabbi-run command line.

Any solution for my case?

Appreciate if you have answers on it.

cdent commented 5 years ago

I'm not sure if you are referring to environment variables (which you would access in the yaml files via $ENVIRON['SOME_NAME'] or to things like $LOCATION and $RESPONSE that are part of the gabbi substitution functionality.

If it $ENVIRON you can run gabbi-run multiple times from the same shell and in that shell set the environment.

If it is things like $RESPONSE then the right thing to do would be to put more than one test in each yaml file. Gabbi is designed so that each file represents a series of multiple tests which describe a single interaction with the API. If you have tests that rely on the responses of other requests, then they should be in the same file.

Let me know if you've still got questions, if not, please close the issue. Thanks.

taget commented 5 years ago

@cdent Thanks for your reply, close this issue.