How do I output some information in Postman tests?

console.log(tv4.error);
tests["Valid Data1"] = tv4.validate(data1, schema);

console.log() seems to be working but I want to output my info into the same panel where my assertions go (for easier correlation):

enter image description here


Solution 1:

Just make a fake test that passes:

var jsonData = JSON.parse(responseBody);
tests["id = " + jsonData.id] = true;              // debug message
tests["name = " + jsonData.name] = true;          // debug message

Solution 2:

Reference for the people who just want to use Chrome’s Developer Tools (which will let you see console output and give you many more features)

To enable it

  1. Type chrome://flags inside your Chrome URL window
  2. Search for "Debugging for packed apps" setting
  3. Enable the setting
  4. Restart Chrome

You can access the Developer Tools window by right clicking anywhere inside Postman and selecting "inspect element".

You can also go to chrome://inspect/#apps and then click "inspect"

Reference

Solution 3:

I used this, which isn't the prettiest, but it works for what I needed.

tests["your test name here " + data.data.length] = data.data.length > 100;

Solution 4:

Piggybacking on the other answers, just define a function in your Postman test code

var print = function(s){
  tests[s] = true;  
};

then consume it like

print("current value of x: " + x);

Solution 5:

Now You have got sth called "Postman Console" To run it please type CTRL + ALT + C For mor info see here: https://blog.getpostman.com/2016/08/26/the-postman-console/