Properties & Groovy Scripting in SoapUI


Properties are a central repository to store our information. A property is a named string value that can be accessed from a script.

There are two types of properties in SoapUI, namely, Default Properties and Custom (User-Defined) Properties.

Types of Properties:

Default Properties:

These are the sets of properties that comes by default with every SoapUI. We can change the values of these properties (but not in every case) and consume as and when needed.

Custom Properties:

These are the properties that the user defines as per requirements. It can be used as a temporary storage for validating the result of tests.

Also, in SoapUI definitions of properties are at multiple levels like Projects, Test Suites, Test Cases, Test Steps and Global Properties. Now, we shall look at each one of these in detail.

Levels of Properties:

  • Project Properties:

Project properties are the properties that are associated with the current project. This property can be accessed by all the subsets like test suite, test case, test step, a script of the project.

Below are the Groovy scripts to get and set properties from project:

//get property
 def projectProperty = testRunner.testcase.testsuite.project.getPropertyValue(“projectProperty”)
 //set property
 testRunner.testCase.testSuite.project.setPropertyValue(“projectProperty”, value)

Test Suite Properties:

Test suite property specifies the properties associated with the current test suite. This property can be used by its subsets like test case, test step and script of test suite.

Groovy scripts to get and set properties from Test Suite:

//get property
 def testSuiteProperty = testRunner.testcase.testsuite.getPropertyValue(“suiteProperty”)
 //set property
 testRunner.testCase.testSuite.setPropertyValue(“suiteProperty”, value)

Test Case Properties:

Specify the properties associated with the current test case. It can be used by test step and script of the test cases.

Groovy scripts to get and set properties from Test Case:

//get property
 def testCaseProperty = testRunner.testcase.getPropertyValue(“caseProperty”)
 //set property
 testRunner.testCase.setPropertyValue(“caseProperty”, value)

Test Step Properties:

Test step properties specify the properties associated with the current test step. It can be used by its subsets like test step, property transfer and script of the test steps.

Groovy scripts to get and set properties of Test Steps:

//get property
 def testStepProperty = testRunner.testcase.testStep.getPropertyValue(“stepProperty”)
 def myteststep = testcase.getTestStepAt(IndexNumber)
 def teststep = TestCase.getTestStepByName(“Name of the Step”)
 //set property
 testRunner.testCase.testStep.setPropertyValue(“stepProperty”, value)

Global Properties:

Global properties define the properties associated with installed version of soapui. These properties can be accessed across the project, test suites, test cases and so on.

Groovy scripts to get and set properties from Global:

//get property
 def globalProperty = com.eviware.soapui.SoapUI.globalProperties.getPropertyValue(“GlobalProperty”)
 //set property
 Com.eviware.soapui.SoapUI.globalProperties.setPropertyValue(“GlobalProperty”, value)


Properties help transfer the data between the test steps such as test suites, test steps, and test cases. Property can be defined through the groovy script. Also, we can assign and retrieve data of the properties through the groovy script.

By Deepika M S

Deepika works as Software Test Engineer with Trigent Software. She has over five years of IT industry experience in testing web-based & mobile applications using both manual and automation testing. Deepika is also experienced in identifying test scenarios and designing effective test cases and is well versed with SDLC/Agile and Scrum methodologies. Deepika has been involved in developing automated test scripts for new features, analyzing results and reports on test results.

View all of Deepika M S's posts.