# HG changeset patch # User Oleksandr Gavenko # Date 1525862375 -10800 # Node ID c713fb5d5c311eba98b85f582c6457f3195e538b # Parent efe2882b5554473f2f044dbe59e538b81326e12e Working with properties from Groovy diff -r efe2882b5554 -r c713fb5d5c31 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.