Forum Discussion
tinoboehme
11 years agoOccasional Contributor
Hello,
the point is that the ScriptLibrary (C:\Program Files\SmartBear\soapUI-Pro-4.5.1\bin\scripts\soapui\ used in groovy with soapui.*) is not imported within subscripts:
Thus I don't think it is a groovy issue, it is more an issue how the script library is implemented.
Or you can give me a hint how to import the ScriptLibrary to make the commands above up and running.
What I want to achieve:
- use own functions with in the XML's requests like <XmlTag>${=soapui.utils.MyUtils.randInt(10,20)}</XmlTag>
- import dynamic libraries based on a property e.g.
This should initialize an object of the class XYZ from the file "C:\Program Files\SmartBear\soapUI-Pro-4.5.1\bin\scripts\soapui\libs\XYZ.groovy" and handover the variable myLibName to the constructor.
This is working fine with build in groovy mathods / classes but and within an groovy teststep not within own classes, why?
Do I have to import a class or open a package?
Regards Tino
the point is that the ScriptLibrary (C:\Program Files\SmartBear\soapUI-Pro-4.5.1\bin\scripts\soapui\ used in groovy with soapui.*) is not imported within subscripts:
context.expand('<XmlTag>${=soapui.utils.MyUtils.randInt(10,20)}</XmlTag>')) // return "<XmlTag>No such property: soapui for class: Script3</XmlTag>"
Eval.me("soapui.utils.MyUtils.randInt(10,20)") // groovy.lang.MissingPropertyException: No such property soapui for class: Script1
Thus I don't think it is a groovy issue, it is more an issue how the script library is implemented.
Or you can give me a hint how to import the ScriptLibrary to make the commands above up and running.
What I want to achieve:
- use own functions with in the XML's requests like <XmlTag>${=soapui.utils.MyUtils.randInt(10,20)}</XmlTag>
- import dynamic libraries based on a property e.g.
Property['Lib'] = "XYZ"
myLibName = project.getPropertyValue('Lib')
def myLib = evaluate(new soapui.libs."+myLibName+"(myLibName)")
This should initialize an object of the class XYZ from the file "C:\Program Files\SmartBear\soapUI-Pro-4.5.1\bin\scripts\soapui\libs\XYZ.groovy" and handover the variable myLibName to the constructor.
This is working fine with build in groovy mathods / classes but and within an groovy teststep not within own classes, why?
Do I have to import a class or open a package?
Regards Tino
Related Content
- 5 years agoComputingFroggy
- 13 years agogordillo_ramon