Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

Testing with API assigned identifiers #109

Closed
patrickbcullen opened this issue Oct 16, 2014 · 2 comments
Closed

Testing with API assigned identifiers #109

patrickbcullen opened this issue Oct 16, 2014 · 2 comments

Comments

@patrickbcullen
Copy link

I have an API that assigns an identifier to a resource during the POST request. In my *.apib file I am required to hard code this identifier in my expectations. This obviously does not work because the id changes with every POST. Is there a way to have dredd ignore API generated identifiers?

@netmilk
Copy link
Contributor

netmilk commented Oct 17, 2014

Hi, this can be solved by using stash for responses in hooks and replacing desired value in transaction dynamically in before hook. Here is an example application using this pattern.

@patrickbcullen
Copy link
Author

That worked great for me. Thanks for the help.

artem-zakharchenko pushed a commit that referenced this issue Oct 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants