Skip to content

Checking number length in json response body #114

Answered by ASaiAnudeep
vladparl asked this question in Q&A
Discussion options

You must be logged in to vote

To compare dynamic values in JSON response, we can use expectJsonLike method which is mapped to the following step definition

Then(/^I expect response should have a json like$/, function (json) {
  spec.response().should.have.jsonLike(JSON.parse(json));
});

Use Assert Expressions to easily solve the problem.

Then I expect response should have a json like
"""
{
  "page": {
    "totalItems": "$V > 41739"
  }
}
"""

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@vladparl
Comment options

Answer selected by ASaiAnudeep
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested
2 participants