Closed SabreenKaur closed 1 year ago
You can pass them using the extra_kwargs
key: https://tavern.readthedocs.io/en/latest/basics.html#calling-external-functions , eg
response:
status_code: 200
verify_response_with:
- function: test_utils:my-function
extra_kwargs:
file_dir: /path/to/dir
Thank you, I managed to use extra_args
instead of extra_kwargs
which worked for my purpose. Could I please ask what is the difference between the two and in what cases is it better to use one over the other?
There isn't any particular difference between them, it's just the difference between args and kwargs in python (kwargs are passed by name)
I have a test which is using an external function I wrote in a separate python file called test_utils.py. I would like to be able to pass other parameters to this function so that I can use it in the function body. For example I would like to pass a file directory as a parameter to the function
my-function
in the below testtest_verify_results.tavern.yaml
test_utils.yaml
Is possible to pass parameters to own defined functions in this way?