SOAPUI - Open Source - Groovy Scripting
SOAPUI - Open Source - Groovy Scripting
Groovy Scripting
1. Using Log variable
log.info(“Any Text message ” + anyVariable)
2. Using Context variable
def myVar = context.expand( ‘${#TestCase#SourceTestStep}’) //will
expand TestCase property value into the new variable
context.testCase // returns the current testCase handle
8. Converting String into Integer & Integer into String using groovy
anyStringVar = anyIntegerVar.toString()
anyIntegerVar = anyStringVar.toInteger()
9. Reading & Writing user-defined property with Groovy
def userIdInStep = testRunner.testCase.getTestStepByName(
“UserDefinedProperty” )
def userIdStr = userIdInStep.getPropertyValue( “myPropertyName” );
userIdInStep.setPropertyValue(“myPropertyName”, “StringValueAsInput”)