Forum Discussion

pranai1234's avatar
pranai1234
New Contributor
7 years ago

using groovy lib script file to set global properties in SOAPUI

Hi All,

 

Has anyone tried to set global properties via groovy lib script  can I create a class outside soapUI in groovy lib and set the Global properties in it ?

 

so that I can call that class in soap UI and reuse it. Please suggest?

2 Replies

  • StevenColon's avatar
    StevenColon
    SmartBear Alumni (Retired)

    Thank you for posting to our Community Forum.

     

    I have attached the external groovy class that defines methods to set and get a Global Property.

     

    Here is the code for the Groovy Script TestStep to call the class and methods

     

    globalPropertiesConnector = new GlobalPropertiesConnector()
    globalPropertiesConnector.setProperty("Property Name","Property Value") log.info globalPropertiesConnector.getProperty("Property Name")

    Please note that you need to set the Script Library field under Preferences>ReadyAPI to the directory that contains this script.

     

    Here is our documentation on script libraries for you to explore: https://support.smartbear.com/readyapi/docs/testing/scripts/library.html

     

    Have a great day!

  • nmrao's avatar
    nmrao
    Champion Level 3
    pranai1234, did you check the answer provided by StevenColon? It is appreciated if you updated with worked or not worked when someone answered your question.