This guide is centred around SoapUI properties. In the past SoapUI guide, we examined the incorporation of properties into Groovy scripts.
In SoapUI, properties function much like variables or parameters. This guide will delve deeper into property usage in service requests and how to assign response values to them using scripts. We will also go over property transfer test steps and property importing processes.
Recommended IPTV Service Providers
- IPTVGREAT – Rating 4.8/5 ( 600+ Reviews )
- IPTVRESALE – Rating 5/5 ( 200+ Reviews )
- IPTVGANG – Rating 4.7/5 ( 1200+ Reviews )
- IPTVUNLOCK – Rating 5/5 ( 65 Reviews )
- IPTVFOLLOW -Rating 5/5 ( 48 Reviews )
- IPTVTOPS – Rating 5/5 ( 43 Reviews )
Welcome to the 8th chapter of our SoapUI online course series.
What knowledge will you gain from this SoapUI Guide?
- Diverse Types of Properties
- Integration of Properties in Service Requests
- Grasping Property Transfer Test Steps
- Importing Properties Externally
SoapUI has two kinds of properties:
- Default Properties: These come packaged with the SoapUI software. While you can edit some default properties, not all are editable.
- Custom/User-Defined Properties: These properties are established by us at the necessary level, be it global, project, test suite, test case, or test step.
Properties are mainly utilized to store and fetch data during test case implementation. Properties save data internally in a key-value manner.
For instance, in the statement below, “Local_Property_FromCurrency” serves as the key name, and “USD” stands for the corresponding value. To access a property’s value, we must use its name.
testRunner.testCase.testSteps[“Properties”].setPropertyValue
( “Local_Property_FromCurrency“, ‘USD’)
What You Will Learn:
Different property levels in SoapUI Pro
In this section, we will discuss the various levels of properties in SoapUI Pro. SoapUI has three different property levels.
Level #1: Project and Custom Properties
On this level, properties split into two parts: project properties and custom properties. When you click on the project name, these display at the bottom of the navigation panel. The project properties segment encompasses default properties established during project creation, such as Name, Description, and File, among others.
You can build custom properties using the custom properties tab. By clicking the plus sign, you can add properties:
There are more options available such as remove, move up, move down, and sorting next to the add button. You can add and use any amount of custom properties across any sections (test suites, test cases) within the project.
Level #2: Test Suite and Custom Properties
These properties are only visible within the test suite. A test suite can contain limitless properties, and you can access them from any test steps belonging to the relative test suite.
Click on the respective test suite name under the project to view the test suite properties. To incorporate custom properties, click on the custom properties tab and then on the “+” symbol beneath it.
Property #3: Test Case and Custom Properties
Test case properties can be accessed within the test case itself. Other test case steps or even the test suite under the project cannot access them.
Further details about properties with examples
Properties can store details such as endpoints, login data, header data, and domains. Although we went over reading and writing data into/from properties, we have not yet examined this topic thoroughly with examples.
The earlier discussed property levels are used in scripts to retrieve data.
#1. Reading properties:
Let’s start by investigating how to read properties in a Groovy script. We can utilize the following syntax to access properties on different levels:
For Project properties: ${# Project Name # Value }
Example:
def projectProperty = testRunner.testCase.testSuite.project.getPropertyValue
( “Project_Level_Property” )
log.info (projectProperty)
For Test Suite properties: ${# TestSuite # Value }
Example:
def testSuiteProperty = testRunner.testCase.testSuite.getPropertyValue(‘Testsuite_Property’)
log.info (testSuiteProperty)
For Test Case properties: ${# TestCase # Value }
Example:
def testCaseProperty = testRunner.testCase.getPropertyValue(‘Testcase_Property’)
log.info (testCaseProperty)
You can refer to the screenshot below for reference:
#2. Writing to properties:
We can use the setPropertyValue method to write to properties.
Syntax: setPropertyValue (“property name”,”value”)
If we assign values to unknown properties, SoapUI will generate these properties. If the properties already exist, their values will be updated during the assignment.
#3. Deleting Properties via Script:
You can remove properties by right-clicking on the property name in the property panel and choosing the Remove option from the context menu.
To delete custom properties using a script, use the statements below for the project, test suite, or test case levels:
testRunner.testCase.testSuite.project.removeProperty( “Testcase_Property” );
testRunner.testCase.testSuite.removeProperty( “Testcase_Property” );
testRunner.testCase.removeProperty( “Testcase_Property” );
The above scripts are not efficient when handling multiple properties on each level, as these steps must be repeated for each property. An alternative method is to cycle through the properties using the script below:
testRunner.testCase.properties.each
{
key,value ->
testRunner.testCase.removeProperty(key)
}
The above script will cycle through all the properties within the test case. “Key” refers to the property name, while “value” represents the property’s actual value. The above script can be modified to remove multiple properties present on different levels.
#4. Add property:
The addProperty method is employed to add