I'm looking for a way to store the result of a test as a boolean. There is any way I can use pm.response.to.have.body("Example")
?
Asked
Active
Viewed 20 times
0

Jack1886
- 37
- 7
1 Answers
0
You can do like this:
var isExamplePresent = pm.response.text().includes("Example");
The includes()
method checks if the response body contains the string "Example". The result is then stored in the isExamplePresent
variable as a boolean value.

Christian Baumann
- 3,188
- 3
- 20
- 37