Forum Discussion

Syamala's avatar
Syamala
Occasional Contributor
15 years ago

How to change a value for a Global property value from a groovy script

I have created a Global value (from File->Preferences->Global Properties), I have set a certain value to it.
I could able to access the value from a Groovy Script
    def Value = context.expand( '${Value}' )

From another groovy script I would like to modify the value and set the new value to the Global value .

How can I do this with groovy scripts.

Thanks
Syamala

4 Replies

  • M_McDonald's avatar
    M_McDonald
    Super Contributor
    For a property called prop1 try this:

    //show the value
    log.info SoapUI.getGlobalProperties().getProperty('prop1').value

    // set the value
    SoapUI.getGlobalProperties().getProperty('prop1').setValue('new value')

    // show the new value
    log.info SoapUI.getGlobalProperties().getProperty('prop1').value
  • Syamala's avatar
    Syamala
    Occasional Contributor
    Thankyou for your reply...

    But still I am facing the problem while executing...I am getting following error.


    "groovy.lang.MissingPropertyException:No such property: SoapUI for class:"

    Could you please look into it.

    Thanks
  • M_McDonald's avatar
    M_McDonald
    Super Contributor
    Maybe an import statement at the top of the script:

    import com.eviware.soapui.SoapUI
  • Syamala's avatar
    Syamala
    Occasional Contributor
    Yes !! its working now...

    Thankyou very much for your help

    Syamala