Validate data in response when using csv file

I am using CSV data file in the Postman Collection Runner


My csv file looks like
|testtwo|test 456|Login Unsuccessful|
|testthree|test789|Registration not complete|

Now when I execute this test via runner how do I validate the message in response body against the message specified in my file

@postmnrequest You can access the data file variable value in the Test script using the data[keyName] format or pm.iterationData.get(keyName)

Then, you can further grab the field that you want to test from your response.

An example test would be like this:

pm.test('Message validation', function () {
    let expectedMessage = data['message'],
        message = _.get(pm.response.json(), 'message'); // you can modify this according to your response body
1 Like