Working with properties from Groovy
authorOleksandr Gavenko <gavenkoa@gmail.com>
Wed, 09 May 2018 13:39:35 +0300
changeset 2250 c713fb5d5c31
parent 2249 efe2882b5554
child 2251 841872ee6d85
Working with properties from Groovy
soapui.rst
--- a/soapui.rst	Wed May 09 12:26:18 2018 +0300
+++ b/soapui.rst	Wed May 09 13:39:35 2018 +0300
@@ -9,14 +9,51 @@
 Property syntax
 ===============
 
-Injecting project property::
+Injecting property::
+
+  ${#Project#NAME}
+  ${#TestSuite#NAME}
+  ${#TestCase#NAME}
+
+Injecting Groovy script result::
 
-  ${#Project#VAR}
+  ${=(int)(Math.random()*1000)}
+  ${=new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(new Date())}
+  ${=import static java.util.UUID.randomUUID; randomUUID() as String}
+
+https://www.soapui.org/scripting-properties/property-expansion.html
+  Property Expansion.
+https://www.soapui.org/docs/functional-testing/properties/transferring-properties.html
+  Transferring Property Values.
+
+Working with properties from Groovy
+===================================
+
+Accessing properties::
 
-Assigning property from Groovy
-==============================
+  testRunner.testCase.getPropertyValue("NAME")
+  testRunner.testCase.testSuite.getPropertyValue("NAME")
+  testRunner.testCase.testSuite.project.getPropertyValue("NAME")
+
+Setting properties::
+
+  testRunner.testCase.setPropertyValue("NAME", "VAL");
+  testRunner.testCase.testSuite.setPropertyValue("NAME", "VAL");
+  testRunner.testCase.testSuite.project.setPropertyValue("NAME", "VAL");
+
+Working with global properties::
 
-For project::
+  com.eviware.soapui.SoapUI.globalProperties.getPropertyValue("NAME")
+  com.eviware.soapui.SoapUI.globalProperties.setPropertyValue("NAME", "VAL")
+  com.eviware.soapui.SoapUI.globalProperties.getProperty("NAME").setValue("VAL")
+
+There is ``removeProperty`` method for removing properties.
 
-  testRunner.testCase.testSuite.project.setPropertyValue("debug", "yes");
+To expand property syntax::
+
+  context.expand( '${#Project#PROP}' )
 
+https://www.soapui.org/docs/functional-testing/properties/working-with-properties.html
+  Working with Properties.
+https://www.soapui.org/scripting-properties/tips-tricks.html
+  Accessing Properties.