Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Actionable error message for large json documents #45

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

Merged
martin-helmich merged 3 commits into martin-helmich:master from hibikiledo:master
Mar 29, 2021

Conversation

@hibikiledo
Copy link
Contributor

@hibikiledo hibikiledo commented Mar 21, 2021
edited
Loading

Problem

When using assertJsonDocumentMatches, it is hard to navigate the error message when the assertion fails.

The message only states that the given JSON document is not a match of the provided constraints.
It would be great to also tell which constraint(s) the JSON document fails to satisfy.

Solution

I implement additionalFailureDescription in JsonValueMatchesMany constraint to return a string representation of constraints that fail during evaluations.

The result would look like this.

Screen Shot 2564年03月21日 at 07 41 33

I think this would greatly simplify investigation when the tests fail.

Thank you

Copy link
Owner

@martin-helmich martin-helmich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution, @hibikiledo! 👍 Full ACK that this is an entirely sensible change to make -- the validation messages, especially for larger assertions, are currently not optimal and can be improved significantly.

I'm just having one thought regarding the statefulness of the JsonValueMatchesAny constraint (see the respective comment). Let me know your thoughts on this.

Copy link
Owner

@martin-helmich martin-helmich left a comment
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looking good! I just added (and already applied) one quick suggestion (whitespace only) to make codeclimate stop complaining.

@martin-helmich martin-helmich merged commit e2ff61f into martin-helmich:master Mar 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@martin-helmich martin-helmich martin-helmich approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /