ERROR: An error occurred [java.lang.ClassCastException]
Hi
I am trying to add a Groovy Script to compare Data Source Results with Rest API Resuest. I am asserting as a individual Step. Currently it is erroring out and the error is Java.Lang.ClassCastException.
If I Remove For Loop then Script passes, but i want script to go through all records in db and compare all node elements from API
import groovy.xml.*
import groovy.json.JsonSlurper
//Grabbing db Response
def cO_RecordID = context.expand( '${DataSource#cO_RecordID }' ) //retreive record id
def db_recordid = cO_RecordID .toString() // Casting Result to String
log.info db_recordid
//Grabbing Json Response
def Jsonresponse_RecordId = context.expand( '${Get Funding Frequencies#Response}' ) //retreiving Json Response
log.info Jsonresponse_RecordId
def Json_Object = new JsonSlurper().parseText(Jsonresponse_RecordId) // putting Json Response into an Object
log.info Json_Object.items.id[0].toString()
def ItemCountResponse = context.expand( '${Get Funding Frequencies#Response#$[\'itemCount\']}' )
log.info ItemCountResponse.toString()
def int i;
for(i=0; i<=ItemCountResponse; i++)
{
if(i<ItemCountResponse)
{
//testRunner.runTestStepByName("Get Funding Frequencies")
log.info i
}
else
{
End
}
}
Can anyone guide me through this error, also if you can confirm if the For Loop Statement is correct in my script that would be great.