imbo / behat-api-extension

API extension for Behat, used to ease testing of JSON-based APIs
MIT License
107 stars 42 forks source link

New step: "Then the response body does not contain JSON" #105

Open milkovsky opened 2 years ago

milkovsky commented 2 years ago

Missing a step to verify, that data does not exist in the API response.

christeredvartsen commented 2 years ago

So basically something like:

Then the response body is empty

?

milkovsky commented 2 years ago

@christeredvartsen the response body may be non-empty. I want to check, whether the JSON body contains a specific value. For example:


Then the response body does not contain JSON
"""
{
  "foo": "bar"
}
"""
christeredvartsen commented 2 years ago

Ah, I see.

I can try to implement a step that does something like this and see how it ends up. I can have something testable in a few days.

milkovsky commented 2 years ago

@christeredvartsen I added a small PR with a proof of concept.