Sorry but I searched the community but could not find a fix hence troubling the experts here.
One of my API has a json response body as below:
{
“suggestions”: [
{
“value”: “jacket”
},
{
“value”: “jacquard-knit socks”
},
{
“value”: “jacquard-knit jumper”
},
{
“value”: “jacquard-weave cotton rug”
},
{
“value”: “jacquard-weave skirt”
}
]
}
Now I need to validate each value of key “value:” with expected data set. should I create data set variables in Predefined script ? Not sure how this can be done, please suggect/help.
i used pm.test(“Body matches string”, function () {
pm.expect(pm.response.text()).to.include(“jacket”,“jacket super skinny fit”,“jacket skinny fit”,“jacket slim fit”,“jacket with faux fur lining” );
To extend my test, how do I compare my response array with already defined data of array.
For eg, send in jeans and get above. Would like to test with more data, how do I achieve that. please help.
Dont really understand how my test is weak considering that I input a search and result is an array of values. I need to validate those values depending upon some predefined expected data.
Is there a way to create a mapping? or you suggest how to make my test realistic.