Skip to content
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

Add jsonpath string to jsonpath assertion error message #5717

Conversation

lehmannk
Copy link

Description

This PR adds the jsonpath string to the jsonpath assertion error message so it is easier to understand the actual error.

Motivation and Context

Currently, the jsonpath error produced when a mismatch occurs is not easy to understand because it does not contain the underlying analyzed jsonpath.

Example:

Assertion error:false
Assertion failure:true
Assertion failure message:Value expected to be 'true', but found '[]'

There is no way to understand what is expected to be 'true' here.

Thus, the actual jsonpath which caused the error shall be added, example:

Assertion error:false
Assertion failure:true
Assertion failure message:Value in json path '$.response.valid' expected to be 'true', but found '[]'

How Has This Been Tested?

tested locally

Screenshots (if appropriate):

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist:

  • [ x] My code follows the code style of this project.
  • [ x] I have updated the documentation accordingly.

Copy link
Collaborator

@vlsi vlsi left a comment

Choose a reason for hiding this comment

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

The change looks good to me, however, please change the other throw statements in doAssert method in the same manner.

@lehmannk lehmannk force-pushed the feature/add_jsonpath_to_jsonpath-asserion branch 2 times, most recently from d3ad3cc to e0136c0 Compare October 19, 2022 11:19
@lehmannk lehmannk force-pushed the feature/add_jsonpath_to_jsonpath-asserion branch from e0136c0 to cb3455e Compare October 19, 2022 11:45
@lehmannk
Copy link
Author

modified the requested statements and fixed unit tests accordingle

@lehmannk lehmannk requested a review from vlsi October 19, 2022 12:20
…PathAssertion.java

Co-authored-by: Vladimir Sitnikov <sitnikov.vladimir@gmail.com>
@lehmannk lehmannk requested a review from vlsi November 8, 2022 15:12
@lehmannk
Copy link
Author

Hi @vlsi can you finally approve this PR? All your requested changes are incorporated.

@vlsi vlsi closed this in 74d9040 Dec 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants