Check that the body does not have a text

Your question may already have an answer on the community forum. Please search for related topics, and then read through the guidelines before creating a new topic.

Here’s an outline with best practices for making your inquiry.

My question:
I am trying to make a test and check that the body does not have a text, but I can only find the code that does:
pm.expect(pm.response.text()).to.include(“string to search for”);.
Do you know which one I could use, I need that in the response it does not contain the “uid”.

Hi @andresdurangof, Welcome to the community

you may use the below snippet to test for a response that doesn’t contain a specific test.

pm.expect(pm.response.text()).not.to.include("Your text");

You may get more info on writing tests on the official documentation page.

1 Like