Home > SoapUI > Properties

Properties

Properties

when creating a testsuite or a testcase it is required to send the properties from one step to another step for which there is an option of  ‘Property Transfer’ in soap UI. Especially when you need to transfer the variable to multiple Steps there is a bit of overhead.

The Best practice is to send the properties to higher level and use them.

TestSuite-Level

Set

context.gettestcase().gettestsuite().setPropertyValue(“property1”,Variable);

Get

def Var1 = context.expand(‘${#TestSuite#property1}’);

Getting in a Request

<user>${#TestSuite#Property1}</user>
<pwd>${#TestSuite#Property2}</pwd>

Project Level

Set

testrunner.getTestCase().getProject().setProperttyValue(“property3”,Variable3);

Get

def Var3 = context.expand(‘${#Project#property3}’);

Getting in a Request

<user>${#Project#Property3}</user>

<pwd>${#Project#Property3}</pwd>

Note: def is used to define a variable. “def” as an alias of  “Object” and you will understand it in an instant.Further Groovy may give “def” an additional meaning in terms of static and dynamic typing.

Categories: SoapUI
  1. No comments yet.
  1. No trackbacks yet.

Leave a comment