Forum Discussion

CXin's avatar
CXin
Frequent Contributor
10 years ago
Solved

How to write property value in setup script for test suiteS?

I need to set value to custom properties in setup scripts for all test suites. Does any one know how to do that? I tried all below scripts, neither of them work for me. def testCasePrope...
  • SmartBear_Suppo's avatar
    10 years ago
    Hi,

    How are you setting the property? The code you posted is getting the properties that should have already been set. If you would like to set the properties using groovy then the following methods will work.


    testRunner.testCase.setPropertyValue( "MyProp", someValue )
    testRunner.testCase.testSuite.setPropertyValue( "MyProp", someValue )
    testRunner.testCase.testSuite.project.setPropertyValue( "MyProp", someValue )
    com.eviware.soapui.SoapUI.globalProperties.setPropertyValue( "MyProp", someValue )


    That comes from our Tips n' Tricks page here, http://www.soapui.org/Scripting-Propert ... properties.


    Regards,
    Marcus
    SmartBear Support
  • CharlesHarold's avatar
    CharlesHarold
    6 years ago

    Since you are in the Test Suite Setup Script, the "project" object is not available (and you need to define the 'Value' property, if you haven't). Try:

    String Value = "Some Value"
    testSuite.setPropertyValue( "PropName", Value )