Success and Failure Scenarios

Hi Team,

I use Postman scripts the HTML and JSON response.

My Script looks like below
var jsonData = pm.response.json();
pm.test(“Database Connection”, function() {

How do I create a custom message if the above assert condition is failed.
Something like “Database is not up” or “Database is not available”

Can we do that ?

Hey @karumuriabhishek,

You can add an additional argument to eql, with that message:

.to.eql("success" , "Database is not available")

Is that what you’re looking for?

Hello @dannydainton .

Thank you so much !! That’s exactly I was looking for. I wasn’t sure if it was same as Junit syntax.

1 Like

Awesome!! :trophy:

Just also adding this for reference: