I’m setting up a automated test that runs through multiple requests.
If a test doesn’t get any data returned, then I want to set a next request.
This works. But i want to get notified that the test is failed in the Test Result.
Can someone help me with the code?
The response I could get and where I want to manualy set a new request:
{
"response": {
"ResultData": [
{
"valk": []
}
]
}
}
Test i made:
let json = pm.response.json();
if (json.response.ResultData[0].valk.length === 0) {
pm.assert.fail("Test is failed and next request is set");
postman.setNextRequest('d34b0b5c-5980-41ab-81e4-d30ed7cef085')
} else {
pm.collectionVariables.set("valk1RowKey", json.response.ResultData[0].valk[0].RowKey);
}
- Here I want to give a Fail with a comment so i can see it in my Test Results.
- I made up the ‘pm.assert.fail’ as an example. I don’t know the right syntax for it or if it even exists.