Getting AssertionError: expected false to be truthy

I’m trying to run a test script that fetches the data from CSV or JSON file format, but I’m getting the error message as AssertionError: expected false to be truthy.

Reference data:

POST Req=https://reqres.in/api/register
Body={
“email”: “[email protected]”,
“password”: “pistol”
}
Response body:

  1. id: 4
  2. token: “QpwL5tke4Pnpja7X4”

CSV data =

[{
“endpoints”: “api/register”,
“email”: “[email protected]”,
“password”: 1234
}, {
“endpoints”: “api/register”,
“email”: “[email protected]”,
“password”: 12345
}]

Test script= tests[“contains email”]=responseBody.has(data.email);

tests[“contains password”]=responseBody.has(data[“password”]);

Error=AssertionError: expected false to be truthy

Please, need help on this.

hi, you are tring to get info like pass and email from response, but i see your response only has id and token,
if you want to see the csv data you should try to do this in the tests tab:
console.log(data);
then you are able to check the log in the postman console:
e.g.


please reply if you need some more help

In your tests, you’re checking that the responseBody has those properties but as per your example, it only has the idand token properties.

Are you able to clarify the details of your question to explain what you’re trying to do. I would suggest moving your tests to use the newer pm.test object too. :grin: