Hi, I’m looking for recommendations on best practices for implementing multiple tests against a single endpoint. However, the endpoint in question is attached to a test collection with an API definition.
–
Update:
For anyone who might stumble upon this topic looking for an answer, I raised this to Postman’s support team and recieved the following response…
currently is not possible but they are already reviewing all the possible options to fix it and challenges that could arise after its implementation. I have shared your feedback internally with our team and they are already tracking it.
For now, it looks like we’re limited to only one request/test per endpoint defined within our API schemas. This is a shame, as it feels like this would be a fairly common use case for testing API’s. Hopefully we have a feature soon which enables this.
–
Take the following collection example…
This collection is attached to an API schema definition, that passes validation.
Now, I want to extend these tests to cover an additional parameter of the same endpoint, which affects the response. My first thought is to duplicate the request and name these accordingly…
However, this now breaks Postman’s API schema validation…
One option is to duplicate the request name (i.e. naming both requests Query Contacts by Domain
). This “resolves” the issue, but also completely obfuscates why both of the requests exist (at face value, they appear to be duplicates).
I’ve also attempted to implement this within a single request, using variable parameters and iterating over the request. Unfortunately this also breaks the schema validation. I’m not too sure why, but variables within the request body will only pass schema validation if they are wrapped within a string (e.g. "someParam": "{{someVariable}}"
is fine, however "someParam": {{someVariable}}
is not).
If anyone could give me any advice on the cleanest way to achieve this, it would be very much appreciated.
Thanks!