SoapUI makes frequent of custom properties for storing custom values within a Project. A "property" is a named string value (currently all properties are handled as strings) that can be accessed from a Script, a Property Transfer or a Property-Expansion references. SoapUI allows for the definition of properties at multiple levels within the project hierarchy:
Projects : for handling Project scope values, for example a subscription ID.
TestSuite : for handling TestSuite scoped values, can be seen as "arguments" to a TestSuite.
TestCases : for handling TestCase scoped values, can be seen as "arguments" to a TestCase.
Properties TestStep : for providing local values/state within a TestCase.
Local TestStep properties : several TestStep types maintain their own list of properties specific to their functionality : DataSource, DataSink, Run TestCase.
MockServices : for handling MockService scoped values/arguments.
MockResponses : for handling MockResponse scoped values.
Global Properties : for handling Global properties, optionally from an external source.
(Apart from these custom properties, many SoapUI objects expose their own built in properties)
1. Property Editors
Properties are generally editable in three places:
From the selected objects main editor window in a Properties inspector:
From the selected objects Details tab (bottom left) in a Test Properties tab
From the navigator itself when in Property_Mode.
The table available in the first two options has buttons to Add, Remove, Move Up and Down, Clear and Load properties from an external source as well as Save properties to a file. Loading properties has additional options of handling specific properties from a file, and properties already defined on SoapUI objects.
In the table both names and values of properties can be edited as desired.
When renaming a property, SoapUI will attempt to refactor all references to that property in both Property Expansions and Property Transfers.
2. Setting properties from the command-line
Global properties are handled in the Global Properties preferences tab, which contains a standard property-table as described above. These can be specified/overridden by adding a -Dsoapui.properties argument in the soapui.bat/.sh file.
For example, create a properties-file named "properties.txt" containing:
in the SoapUI bin folder. Modify the java arguments in the SoapUI.bat file to be:
set JAVA_OPTS=%JAVA_OPTS% -Xms128m -Xmx256m -Dsoapui.properties=properties.txt
Add the following Property-Expansion to a TestRequest, Endpoint, etc:
When expanded, the specified properties file will be loaded as shown in the SoapUI log:
01:20:05,234 INFO [PropertyExpansionRequestFilter] Loaded 52 properties from [C:\workspace\core\project.properties]
This feature can be especially useful when wanting to specify global endpoints or authentication settings, just specify the corresponding expansions in the endpoint or authentications properties and they will get expanded when used
Both global and system properties can be set directly from the command-line when running any of the SoapUI bat/sh files; -Dproperty.name=value sets a system property and -Gproperty.name=value sets a Global Property.
An extended possibility to override/set properties at the project/testsuite/testcase/mockservice level is also available by adding a
value to the global or system properties, where shortened-name-of-object is the name of the corresponding object with only characters. For example if you have a TestSuite in your project named "TestSuite 1", you can set
which will load the properties in the specified file ("testsuite1props.properties") into the "TestSuite 1" TestSuite properties (please note that any TestSuite names "TestSuite 1" in any of your projects will be affected).
3. Navigator Property Mode
The SoapUI Navigator contains a toggle button on top of the tree. Pressing it will put the Navigator into Property Mode, displaying all Properties for their corresponding objects in the tree (green = read/write, black = read-only), giving an overview of all defined or available properties within a project.
Items containing custom properties (Projects, TestSuites, TestCases, MockServices and MockResponse) will in the tree get a Properties child node contain that objects custom properties.
Double clicking a property prompts to set its value.
Right clicking the Properties node open a menu for adding new properties.
One of the main use cases for this mode is the possibility to drag a property from the tree into any text editor that supports Property Expansion, making it extremely easy to create property expansions as desired. If the property being dragged contains an XML value, the XPath Selector will be displayed after a drop, allowing for further property-expansion refinement