Skip to main content
SoapUI

Properties & Groovy Scripting in SoapUI

Definition:

Properties are 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:

CustomDefault Properties:

These are the sets of properties which 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 which user defines as per requirements. It can be used as a temporary storage for validating the end 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 which are associated with the current project. This property can accessed by all the subsets like test suite, test case, test step, script of the project.

Project Properties

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.

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.

Test Case Properties

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.

Test Step Properties

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.

Global Properties

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)

Conclusion:

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

Deepika M S

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.

5 thoughts on “Properties & Groovy Scripting in SoapUI

  1. Wow, incredible blog format! How lengthy have you been blogging for? you made blogging look easy. The full look of your website is great, let alone the content material!

  2. Hello! I just want to offer you a huge thumbs up for the excellent information you have here on this post. I’ll be coming back to your website for more soon.|

  3. Having read this I thought it was very informative. I appreciate you taking the time and effort to put this article together. I once again find myself spending way to much time both reading and commenting. But so what, it was still worth it!

  4. Hi There! We are searching for some people that might be interested in from working their home on a full-time basis. If you want to earn $500 a day, and you don’t mind developing some short opinions up, this might be perfect opportunity for you! Simply check out the link here NOW!

Comments are closed.