How to handle dynamic IDs in Contract Tests #1077
Replies: 1 comment 1 reply
-
Thanks for reaching out @noelmccrory. Test data setup is indeed a real problem that we see often. In Java projects, Specmatic has support for JDBC stubbing. By stubbing out the DB we can fully control the details such as resource ID. If you are interested in trying out this capability please reach out to us. Also, we have prioritised the support for Open API Links in our backlog. This capability should allow you to use the dynamically generated ID in your HTTP POST call in subsequent API calls. Please let us know if you have any more questions. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
If I have an API that exposes the following endpoints:
POST /my-resource
will create a new record in the database with an autogenerated UUID. That UUID is then used in the PUT and GET operations. I am using examples in my open api spec to drive the contract tests. But I don't see how I can make the {id} part of the call dynamic.I see two options:
Is there any functionality that could help with Option 2? Thanks!
Beta Was this translation helpful? Give feedback.
All reactions