Forum Discussion

JMcKinley's avatar
JMcKinley
Contributor
16 years ago

Question: Dynamically change the script library path?

Is there a way to change the location of the script library path (found in the SOAP UI Pro preferences) at run time?

I looked at the XML for my project and it does not appear to be stored there.

Thanks!
Jim

4 Replies

  • omatzura's avatar
    omatzura
    Super Contributor
    Hi Jim,

    sure, try the following in your script:

    com.eviware.soapui.SoapUI.settings.set( 
      com.eviware.soapui.SoapUIProSettings.SCRIPT_LIBRARY, "<your desired path>" )


    ok?

    regards!

    /Ole
    eviware.com
  • Based on the information you gave me related to this thread:

    http://www.eviware.com/component/option ... opic,652.0

    how does the system find this line and compile the code properly? What I mean is, it appears that the global groovy code is compiled when you bring up SOAP UI Pro, if I create a groovy script with the line of code you provided, does the system immediately go to the specified path and immediatly compile global groovy scripts in that path when the system executes that line of code OR what?

    Also, do you need to use double slashes in the path like you would in Java? For example, if the path was "C:\Test\Test2" where the folder that contains the scripts is Test2, would you add the path like this C:\\Test\\Test2

    Which would make the line of code be this:

    com.eviware.soapui.SoapUI.settings.set(
    com.eviware.soapui.SoapUIProSettings.SCRIPT_LIBRARY, "C:\\Test\Test2")

    Thanks!!
    Jim
  • omatzura's avatar
    omatzura
    Super Contributor
    Hi Jim,

    soapUI Pro periodically (every 5 seconds) checks the configured script-library for changes, so if you change the path to a new value, the new path will be checked the next time around, which will (probably) result in all the scripts in that new location being compiled/loaded.

    Regarding the backslashes; yes, I think you will need double ones just like in java strings..

    regards!

    /Ole
    eviware.com