Using multiple assertions
POST https://postman-echo.com/post
Your tests can include multiple assertions as part of a single test—you can use this to group together related assertions.
pm.test("The response has all properties", () => {
//parse the response json and test three properties
const responseJson = pm.response.json();
pm.expect(responseJson.type).to.eql('vip');
pm.expect(responseJson.name).to.be.a('string');
pm.expect(responseJson.id).to.have.lengthOf(1);
});
If any of the contained assertions fails, the test as a whole will fail. All assertions must be successful for the test to pass.
Request Body
[{"name"=>"name", "value"=>"Melania Trump", "datatype"=>"string"}, {"name"=>"type", "value"=>"vip", "datatype"=>"string"}, {"name"=>"id", "value"=>"5", "datatype"=>"number"}]