Response body was not logged

I have a collection with a request that has a test, which gets pass result when I send the request.

However, when I run my collection in collection runner, the test fails. Response Body dropdown has: Response body was not logged.

Based on the screenshots, what am I doing wrong?

Hi @Pblintso87,

To address your first issue with tests failing in the runner but not in the request, make sure that:

  1. The request is saved with the latest changes.
  2. The correct environment is selected in the Collection Runner options.
  3. If you’re using a data file, make sure it’s not introducing values that would create unexpected results.

To address the problem with not seeing response data in the Collection Runner, please make sure the Save responses option is checked in the Collection Runner before hitting the blue Run button.
image

1 Like

As @kevin.swiber mentioned already, I would take a look at the environment file.

It’s getting a 404 so there is likely something wrong with the URL, as you have an environment variable in there, it’s probably not getting resolved.

I noticed in your tests that you use pm.response.text(), as the response is JSON, you could just use expect statements in the pm.test() function:

pm.expect(pm.response.json()).to.have.property("password");

pm.expect(pm.response.json()).to.have.property("email");
1 Like

@dannydainton, @kevin.swiber

Thank you both for your assistance.

Per Kevin’s tip, I ensured Save responses option is checked, and I also used Danny’s pm.test() function: statements. However, I am still getting the collection run test fail :frowning:
This is the fail result:

I only get a problem when I use text/cvs files. When I used a json-type file, the assertions pass.

This is the environment, and I am not sure where in it the problem is. I just started learning Postman this week, so I haven’t learned its nuances…