Hello, Iām searching a way to repeat an already defined request in a collection when I use another request in order to not duplicate the request.
nextRequest feature doesnāt work for me in this case since this common request will be used in several request in the collection. Also not all of them will use it, so define it in folder level is not a solution for me.
The most important thing for me is the Test part since there I store data generated in the response of the request to be used in later requests, but thatās not the case. I donāt mind if the Pre-request part canāt be executed along with the repeated request.
Iām not sure what is the exact issue but from what I understood is that I think you need to send a specific request inside another based on some condition.
If my understanding of your problem is correct then you can use this solution. I have taken a sample url.
Hello @jchaugule. Thanks for your reply. Maybe your solution is a bit convoluted. My question is to try to trigger an already defined request in a collection (including its Pre-request script and Test scripts) when itās launched another request in the same collection.
To clarify, my case is something like this:
I have a test case that first launches Request A in a collection launched normally with a runner or Newman that creates an object. In its test part itās stored the id of the object and other data.
The next requests work with the previous object created in Request A and finally the object is removed once the test case is finished.
Later in the same collection I want to launch another test case. To do it I need to launch Request B that needs object that is created in Request A. Instead of duplicate the request (including all its Pre-request scripts and Test scripts parts) I would like to āinvokeā Request A (including its Pre-request and Test scripts). This generates a new object so I need to store its data as before (id from Mongo database and so on).
Then I continue with other requests and finishes the test case.
The bold part is what Iām searching to achieve in order to avoid duplication of code and maintenance of all of this.