GMSoapUI
12 years agoContributor
[Resolved] Unable to get centralised script working.
I am having difficulty in centralising a small routine for padding a string with a set number of characters.
It is called from a TestRunListener.afterStep event handler as follows:
My global property for scripts is set at the default of C:\Program Files (x86)\SmartBear\SoapUI-Pro-4.6.2\bin\scripts.
Within this folder location I have a folder 'soapui' and within that a folder called 'demo' (as per the default installation of SoapUI Pro). Within the 'demo' folder I have a .groovy file called 'stringPad' and it contains the following code:
However, when I run the code that calls this code the SoapUI Log reports that soapui is an unknown property of the class. I followed the instructions here: http://www.soapui.org/Scripting-Properties/scripting-and-the-script-library.html but just cannot seem to get this working. What have I missed please?
It is called from a TestRunListener.afterStep event handler as follows:
log.info( soapui.demo.stringPad.fncPadString( " ", 7 ) + " TEST RESULT" );
My global property for scripts is set at the default of C:\Program Files (x86)\SmartBear\SoapUI-Pro-4.6.2\bin\scripts.
Within this folder location I have a folder 'soapui' and within that a folder called 'demo' (as per the default installation of SoapUI Pro). Within the 'demo' folder I have a .groovy file called 'stringPad' and it contains the following code:
package soapui.demo
class stringPad
{
def strChar
def intLength
stringPad( strCharacterToPadWith, intLengthToPadBy)
{
strChar = strCharacterToPadWith;
intLength = intLengthToPadBy;
}
def static fncPadString( strCharacterToPadWith, intLengthToPadBy )
{
strPadString = "";
for( int intCount = 0; intCount < intLengthToPadBy; intCount++ )
{
strPadString = strPadString + strPadCharacter;
}
return strPadString;
}
}
However, when I run the code that calls this code the SoapUI Log reports that soapui is an unknown property of the class. I followed the instructions here: http://www.soapui.org/Scripting-Properties/scripting-and-the-script-library.html but just cannot seem to get this working. What have I missed please?