Forum Discussion
SmartBear_Suppo
Alumni
12 years agoHi,
This a syntax problem with the script you posted. Certain variables were not declared and the class was not instantiated in the event handler.
I am able to use C:\Program Files (x86)\SmartBear\SoapUI-Pro-4.6.2\bin\scripts as the global script folder and run the script you posted with some modifications.
Event handler TestRunListener.afterStep:
Should produce the following in the script log:
Thu Dec 12 11:22:14 EST 2013:INFO:Hello Ole
Thu Dec 12 11:22:14 EST 2013:INFO:a a a a a a a
As an FYI we do not support custom code solutions.
Regards,
Marcus
SmartBear Support
This a syntax problem with the script you posted. Certain variables were not declared and the class was not instantiated in the event handler.
I am able to use C:\Program Files (x86)\SmartBear\SoapUI-Pro-4.6.2\bin\scripts as the global script folder and run the script you posted with some modifications.
package soapui.demo
class stringPad
{
def strChar
def intLength
/*stringPad( strCharacterToPadWith, intLengthToPadBy)
{
strChar = strCharacterToPadWith;
intLength = intLengthToPadBy;
}*/
static fncPadString( strCharacterToPadWith, intLengthToPadBy )
{
def strPadString = "";
for( int intCount = 0; intCount < intLengthToPadBy; intCount++ )
{
strPadString = strPadString + strCharacterToPadWith;
}
return strPadString;
}
}
Event handler TestRunListener.afterStep:
def greet = new soapui.demo.Greet( "Ole", log )
greet.salute()
def sp = new soapui.demo.stringPad()
log.info sp.fncPadString( "a ", 7 )
Should produce the following in the script log:
Thu Dec 12 11:22:14 EST 2013:INFO:Hello Ole
Thu Dec 12 11:22:14 EST 2013:INFO:a a a a a a a
As an FYI we do not support custom code solutions.
Regards,
Marcus
SmartBear Support