Forum Discussion

NK12's avatar
NK12
Occasional Contributor
7 years ago

Not able to capture the DB response in variable

Have created the array and XmlSlurper for capturing db response

 

def dbvalues=[]
dbsluper.ResultSet.Row.each{
 dbvalues.add(it.value)
}

 

log.info("Db results"+dbvalues)

 

output:It is giving empty results

 

I need to compare my json response with db response

 

My json structure has nearly 200 elements which are non repitive

 

can you please suggest what is the best way to achieve this

 

Thanks!!

1 Reply

  • StevenColon's avatar
    StevenColon
    SmartBear Alumni (Retired)

    Thank you for posting to our Community Forum.

     

    The script snippet provided isn't enough information to assess where the issue is occurring. Please provide the full script where you are using XMLSlurper to parse the DB.

     

    To compare that information to a JSON response, you need to parse the response with JSON Slurper and run the comparison.

     

    http://docs.groovy-lang.org/2.4.9/html/gapi/groovy/json/JsonSlurper.html

     

    Have a great day!