0

I have given a parameter in request(eg:date=2020-03-12) I need to verify the same date is present in response or not, by not giving the value(2020-03-12) directly in script. Because this date is dynamic and will be changed often. So I need to check the value of the date given in request is present in response using the date variable alone. I hope the question is clear

Immanuel
  • 49
  • 3
  • 8

1 Answers1

0

Both the Request and Response objects are available when testing, so you can check that a value is present. Assuming json payloads:

pm.test('Response contains data from Request', function () {
    const RequestJSON = pm.request.json();
    const ResponseJSON = pm.response.json();

    pm.expect(RequestJSON.Text).to.equal('Request Text in Text field');
    pm.expect(ResponseJSON.Text).to.equal('Request Text in Text field');

    // Or if you do not care about the field data
    pm.expect(RequestJSON.Text).to.equal(ResponseJSON.Text);
});
Steven Scott
  • 10,234
  • 9
  • 69
  • 117