svanoort / pyresttest

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

Can I template config and use it for all test cases #234

Open mvitiuk opened 7 years ago

mvitiuk commented 7 years ago

Hi, I'm new to pyresttest, but like it. I have written a set of test cases and all of them have the same config:

- config:
    - testset: "Orders base tests"
    - variable_binds: {
                      'authkey': 'authkey', 'value': 'authvalue',
                      'headername': 'Content-Type', 'headervalue': 'application/json',
                      }

so if I want to change 'authvalue' for all test cases I need to go to each file and change it manully. Is there a way to send ENV value there somehow or template config and change 'authvalue' only one file?

Thank you!

benhowes commented 6 years ago

We made tavern in part to address this issue, it allows and encourages re-using chunks of YAML in the tests: https://taverntesting.github.io/documentation#reusing-requests-and-yaml-fragments