How to verify if response body doesn't contain a specific string?

Hello,

I wonder if there is some simple way to verify if response body DOESN’T contain some string?

Thanks,
Leszek

I found out how to do it.

So snippet to check if a response body CONTAINS some string is:

assertThat(response.getResponseText()).contains('Katalon Test Project')

and to check if the response body DOESN’T contain some string you need to use:

assertThat(response.getResponseText()).doesNotContain('Katalon Test Project')

Quite “funny”…

3 Likes

@leszek.urbanik Glad you got it working and thank you for posting pack with your solution.

Would you prefer I edit this to make it a Tip and post it to Tips & Tricks?

Sure, please feel free to do it :wink: