By Deepika M S on Jan 23, 2017, 6:05:58 AM
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:
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.
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 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:
def projectProperty = testRunner.testcase.testsuite.project.getPropertyValue(“projectProperty”)
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:
def testSuiteProperty = testRunner.testcase.testsuite.getPropertyValue(“suiteProperty”)
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:
def testCaseProperty = testRunner.testcase.getPropertyValue(“caseProperty”)
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:
def testStepProperty = testRunner.testcase.testStep.getPropertyValue(“stepProperty”)
def myteststep = testcase.getTestStepAt(IndexNumber)
def teststep = TestCase.getTestStepByName(“Name of the Step”)
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:
def globalProperty = com.eviware.soapui.SoapUI.globalProperties.getPropertyValue(“GlobalProperty”)
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.