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
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