soapui.rst
changeset 2250 c713fb5d5c31
parent 2249 efe2882b5554
equal deleted inserted replaced
2249:efe2882b5554 2250:c713fb5d5c31
     7    :local:
     7    :local:
     8 
     8 
     9 Property syntax
     9 Property syntax
    10 ===============
    10 ===============
    11 
    11 
    12 Injecting project property::
    12 Injecting property::
    13 
    13 
    14   ${#Project#VAR}
    14   ${#Project#NAME}
       
    15   ${#TestSuite#NAME}
       
    16   ${#TestCase#NAME}
    15 
    17 
    16 Assigning property from Groovy
    18 Injecting Groovy script result::
    17 ==============================
       
    18 
    19 
    19 For project::
    20   ${=(int)(Math.random()*1000)}
       
    21   ${=new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(new Date())}
       
    22   ${=import static java.util.UUID.randomUUID; randomUUID() as String}
    20 
    23 
    21   testRunner.testCase.testSuite.project.setPropertyValue("debug", "yes");
    24 https://www.soapui.org/scripting-properties/property-expansion.html
       
    25   Property Expansion.
       
    26 https://www.soapui.org/docs/functional-testing/properties/transferring-properties.html
       
    27   Transferring Property Values.
    22 
    28 
       
    29 Working with properties from Groovy
       
    30 ===================================
       
    31 
       
    32 Accessing properties::
       
    33 
       
    34   testRunner.testCase.getPropertyValue("NAME")
       
    35   testRunner.testCase.testSuite.getPropertyValue("NAME")
       
    36   testRunner.testCase.testSuite.project.getPropertyValue("NAME")
       
    37 
       
    38 Setting properties::
       
    39 
       
    40   testRunner.testCase.setPropertyValue("NAME", "VAL");
       
    41   testRunner.testCase.testSuite.setPropertyValue("NAME", "VAL");
       
    42   testRunner.testCase.testSuite.project.setPropertyValue("NAME", "VAL");
       
    43 
       
    44 Working with global properties::
       
    45 
       
    46   com.eviware.soapui.SoapUI.globalProperties.getPropertyValue("NAME")
       
    47   com.eviware.soapui.SoapUI.globalProperties.setPropertyValue("NAME", "VAL")
       
    48   com.eviware.soapui.SoapUI.globalProperties.getProperty("NAME").setValue("VAL")
       
    49 
       
    50 There is ``removeProperty`` method for removing properties.
       
    51 
       
    52 To expand property syntax::
       
    53 
       
    54   context.expand( '${#Project#PROP}' )
       
    55 
       
    56 https://www.soapui.org/docs/functional-testing/properties/working-with-properties.html
       
    57   Working with Properties.
       
    58 https://www.soapui.org/scripting-properties/tips-tricks.html
       
    59   Accessing Properties.