Hi,
I have converted the response to text and I am trying to check if it includes the path and value in the response.
When I submit the collection I get an assertion error -
Hi,
I have converted the response to text and I am trying to check if it includes the path and value in the response.
When I submit the collection I get an assertion error -
The response from that API is in JSON format.
The document doesnโt explicitly tell you this, but its expecting you to parse the response as JSON, and then target the relevant element directly.
You are targeting the element using pm.response.text() and the includes assertion, which isnโt the best assertion for this type of test. All you are testing is that โvalueโ exists somewhere in the response. Parse the response to json() and use โto.eqlโ instead and target the element specifically in the response.
Thank you for submitting your post.
I will jump in the last paragraph of @michaelderekjones and give a solution.
The parameter testData
reference the property value
in the data file
From my part , I parse the response to json() and use โto.be.eqlโ to target โpostโ in the response. I reuse that in the next line to check the property value
in the data file.
Allow me to provide an updated solution.
This topic was automatically closed after 30 days. New replies are no longer allowed.
The assertions in that screenshot are not checking the response.
They are targeting the data file.