cancel
Showing results for 
Search instead for 
Did you mean: 

dynamic setting of preferences

SOLVED
Frequent Contributor

dynamic setting of preferences

Hello,

I have a set of groovy scripts set as an external library in my project.

those scripts are located in /my_project/scripts/groovy

When I play my tests via the testRunner, the methods are not found as Preference scripts settings in "ReadyAPI 2.7.0/bin/scripts

I tried to modify dynamically this setting as my test can be executed from different computers, I use the following:

def scripts_path = context.expand( '${#Project#scripts_path}' )

settings = com.eviware.soapui.SoapUI.settings


project = testRunner.testCase.testSuite.project
project.setScriptLibrary(scripts_path)
log.info "project script library : " + project.scriptLibrary // => to check setting is correct

settings.setString( "Script Library", ""); // clear settings
log.info "init pref : " + com.eviware.soapui.SoapUI.settings.getString( "Script Library","default")
settings.setString( "Script Library", scripts_path);
log.info "get pref : " + com.eviware.soapui.SoapUI.settings.getString( "Script Library","default") // => to check setting is correct

Log shows that the path for scripts is the one expected, though it still raises errors.

 

In my soapui-settings.xml (user) I can see that the script library path is not the one expected.

It seems that SOAPUI does not take into account the dynamic change of preference and uses the static value to get the groovy scripts.

 

Is my method of dynamic setting wrong ? I will configure my soapui-settings with the wanted path as a workaround but it's not a correct solution as it may change

 

--- LATEST info :

If I use the testRunner from the application, it works though it does not work if I use testRunner from a TFS build.

If I close the application, then I can see that the Script Library path, in soapui-settings.xml, has been updated with the correct path (though it was not visible in the Preference/ReadyAPI tab of the application !!), after that the TFS build finds the scripts and execution is correct : this shows that testRunner uses only the static definition from soapui-settings and does not allow dynamic settings of Preferences, this is not sustainable as, in my case, TFS builds can load sources in a different path, which would invalidate the current scripts path

 

 

thanks for any help

 

Alexandre

1 ACCEPTED SOLUTION

Accepted Solutions
Frequent Contributor

Re: dynamic setting of preferences

Well, as a solution I opened the UI in the distant computer, set the proper path and exited UI. It saved the settings and now I can use them.

It will probably be enough but I'll have to do it again on next readyAPI version upgrade.

 

I'll try with @nmrao solution of handling separate settings it will be a sustainable solution

 

thanks for your help

 

Alex

View solution in original post

10 REPLIES 10
Community Hero

Re: dynamic setting of preferences

Can't possible to place the scripts in default location? Do they work if you do so?


Regards,
Rao.
Frequent Contributor

Re: dynamic setting of preferences

it is possible, and they work, but it is not sustainable for Continuous Integration as it is not in my repository, so if they are modified, they won't be downloaded automatically. In that case I will have to copy them manually or to build a script that will copy them automatically ...

Highlighted
Community Hero

Re: dynamic setting of preferences

Where did you place the above mentioned script?


Regards,
Rao.
Frequent Contributor

Re: dynamic setting of preferences

in a directory besides the compiste project directory, in my repository

Community Hero

Re: dynamic setting of preferences

Then how & when(at what event) that script is executed?


Regards,
Rao.
Moderator

Re: dynamic setting of preferences

Hi all,

 

Thanks for your investigations, @nmrao.

 

@krogold , have you managed to find a solution? If so, could you please share it?
Otherwise, could you please provide us with some updates?
Thanks in advance.

 


Olga Terentieva
SmartBear Assistant Community Manager

Community Hero

Re: dynamic setting of preferences

It is good and possible to set the configuration changes dynamically.
One more thing can be done. it is also not a bad choice to change the settings thru SoapUI / ReadyAPI tool and save these settings into separate copy (you can have multiple settings file)and use this file while running the tests from command line testrunner utility and it takes settings file as parameter. You can try it.


Regards,
Rao.
Frequent Contributor

Re: dynamic setting of preferences

Well, as a solution I opened the UI in the distant computer, set the proper path and exited UI. It saved the settings and now I can use them.

It will probably be enough but I'll have to do it again on next readyAPI version upgrade.

 

I'll try with @nmrao solution of handling separate settings it will be a sustainable solution

 

thanks for your help

 

Alex

View solution in original post

Community Hero

Re: dynamic setting of preferences

I do not think settings file is required to change per new version. Was it the case that you experienced?


Regards,
Rao.
New Here?
Join us and watch the welcome video:
Watch the new Interview