Forum Discussion
JHunt
7 years agoCommunity Hero
You should be able to see why it's failing, e.g.
XPathContains comparison failed for path [declare namespace ns1='http://localhost/me'; count(/ns1:Response)], expecting [100], actual was [1].
Post your failure and we can help you work out why. See if you can attach the full response for us as well.
It could just be that the response doesn't necessarily have 100 photos. The tutorial you linked specifically says:
- Interestingness Request - gets the current list of Interestingness at flickr in JSON format and validates the response to contain 100 entries (which it actually won’t always do)
- raptor7 years agoOccasional Contributor
I think see 100 photos.
The response I got contains 100 photos I think. I have attached it in a text file.
I validated it by pasting it here and then clicking on 'Viewer'.
- nmrao7 years agoChampion Level 3
Based on the attachment which is json, here is the Script Assertion:
//Check if there is response assert context.response, 'Response is empty or null' def json = new groovy.json.JsonSlurper().parseText(context.response) def actualPhotos = json.photos.photo.size() //log the photo instances log.info actualPhotos def expectedPhotos = 100 assert expectedPhotos == actualPhotos
Related Content
- 7 months agoḥari
- 2 years agoDesktopapptesti
- 2 years agoDesktopapptesti
Recent Discussions
- 7 days agoemoya