Overwriting Request Body for Contract Tests #503
-
Hi there, I have a use case wherein I need to overwrite a default value that is stored in my open api spec. In my api spec, I set a default value for identificationNumber. I have certain business rules in place which preclude the repeated usage of this number. Basically, our system allows for the creation of only 1 application for a given ID number. While this is very simple to do in the context of a variation test, I have not found a way to do this in a contract test. Given that overwriteRequestBody does not appear to be accessible within a contract test, does there exist a technique to affect such an override at the contractTest level? Kind regards, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Not 100% sure of your use-case, but would setting the ID number as a variable be a solution? That way you could define a variable upfront or dynamically and use that in the request overwrite. |
Beta Was this translation helpful? Give feedback.
-
The above suggestion works perfectly. Thanks for the support |
Beta Was this translation helpful? Give feedback.
hi @PaulCluver
The overwrites have a separate section in the config. Since the overwrites will be applied for all "tests".
Have a look at an example:
https://github.com/apideck-libraries/portman/blob/main/portman-config.example.json
the structure is: