For authentication, i am passing the userName and password with POST request.
In Response body output :-
{
“token”: “fd9c6c24e24fbf0”
}
But in Test Output is like : “AssertionError: expected response body to equal ‘token:fd9c6c24e24fbf0’ but got '{“token”:“fd9c6c24e24fbf0”}’”
How to validate, after sending request, Response body have token and it’s value?
pm.test(“Body is correct”, function () {
jsonData=pm.response.json();
pm.expect(pm.response.to.have.body("token"+":"+jsonData.token));
});
OR
pm.test(“token created”, function(){
jsonData=pm.response.json();
pm.response.to.have.body(“token”+":"+jsonData.token)
});