Forum Discussion
SmartBear_Suppo
Alumni
12 years agoHi,
I think your issue is actually in the package import. Initially when I tried your exact first post code, only the following line couldn't be run but if commented out everything executed:
But when I take out the import and just have the code below in a Groovy script step, everything runs:
This is in SoapUI Pro v4.5.2.
Let me know if you still experience the issue.
Thanks,
Michael Giller
SmartBear Software
I think your issue is actually in the package import. Initially when I tried your exact first post code, only the following line couldn't be run but if commented out everything executed:
log.info('<XmlTag>'+soapui.utils.MyUtils.randInt(10,20)+'</XmlTag>') // :) return random valueBut when I take out the import and just have the code below in a Groovy script step, everything runs:
log.info('<XmlTag>'+MyUtils.randInt(10,20)+'</XmlTag>') // :) return random value
log.info('<XmlTag>'+soapui.utils.MyUtils.randInt(10,20)+'</XmlTag>') // :) return random value
log.info(context.expand('<XmlTag>${=(int)10+290*(Math.random())}</XmlTag>')) // :) return random value
log.info(context.expand('<XmlTag>${=java.util.UUID.randomUUID()}</XmlTag>')) // :) return a UUID
log.info(context.expand('<XmlTag>${=MyUtils.randInt(10,20)}</XmlTag>')) // :( return "<XmlTag>No such property: MyUtils for class: Script2</XmlTag>"
log.info(context.expand('<XmlTag>${=soapui.utils.MyUtils.randInt(10,20)}</XmlTag>')) // :( return "<XmlTag>No such property: soapui for class: Script3</XmlTag>"This is in SoapUI Pro v4.5.2.
Let me know if you still experience the issue.
Thanks,
Michael Giller
SmartBear Software