How to print the schema validation in console?

Hi,

I am trying to print the results of pm.test, but so far failed to do so. e.g. I want to print this in the console:
pm.test(“Validation schema”, () => {pm.response.to.have.jsonSchema(schema);

It is a schema validation that I defined, it works fine in showing the Test Results, however, I want the message that appears in Test Results to appear in the console.

I know that I can print the other tests using for example the pm.response.responseTime , however in validating schema until now I couldn’t find a similar approach that enabiles me to do so.

The qusetion: Can I have an approach that prints the schema validation results using the method e.g. console.log(“Pass, responseTime is: " + pm.response.responseTime + " ms”); ?

Thanks.

Basically what I am trying to do an if-else statement that will print the pass or fail for the results that come from the pm.test e.g.

Solution was done by @allenheltondev as here:

How to print the results of pm.test in console? - Help - Postman

1 Like