-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added 'Then the response body does not contain JSON' step. #110
base: main
Are you sure you want to change the base?
Conversation
65c8008
to
83a7610
Compare
Example step:
|
@christeredvartsen , hey. Do you find this feature unnecessary? |
I find the feature somewhat confusing. Would you be able to add some tests for it so I can better understand the use case? |
I was looking for a step like this, and can explain my use-case: Our API endpoint was adding some unwanted code in a field that is otherwise difficult to predict. For example, the response JSON might be something like:
We fixed the problem, but wanted to write a Behat test to ensure it never happened again. Because the text is unpredictable, we can't use
|
} | ||
catch (AssertionFailure $e) { | ||
throw new AssertionFailedException( | ||
'Comparator did not return in a correct manner. Marking assertion as failed.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The message should be 'The searched value was found in the JSON response.'.
@brockfanning you can add the step from the pull request into your custom behat context, that extends |
@christeredvartsen the idea of this feature is to make sure, that unwanted content does not appear in the API. For example, I would like to test an endpoint, that returns all articles from an author.
|
A proof of concept for #105.