[Resolved] Script Library
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2014
09:59 AM
07-02-2014
09:59 AM
[Resolved] Script Library
Hi
Recently we created one class in groovy script library. We are successfully able to access the class from the soapUI's groovy step.
When I deployed the code into the server where we do automation testing, it is not working. From the log I can make out that, soapUI is looking for the Script file in a folder which is an empty. Please refer below screen shot to understand in detail.
soapUI is looking for Script in the folder "rtc_5451". We create this temporary staging folder for each test run. The folder contains latest source from the source control. We do delete the folder once test execution is completed. Ideally soapUI should look for script library in "rtc_4771" which is directory created for the current test cycle. I do set script library path in the load script. You can notice that statement highlighted in yellow color towards the bottom side.
I think [SoapUIProGroovyScriptEngineFactory] is using older path which has been updated in the soapui-seetings.xml file in the previous run.
Why is this happening? Please guide us how can we update library path in the soapui-settings.xml just at the beginning of the test so that it is picked up correctly?
Recently we created one class in groovy script library. We are successfully able to access the class from the soapUI's groovy step.
When I deployed the code into the server where we do automation testing, it is not working. From the log I can make out that, soapUI is looking for the Script file in a folder which is an empty. Please refer below screen shot to understand in detail.
soapUI is looking for Script in the folder "rtc_5451". We create this temporary staging folder for each test run. The folder contains latest source from the source control. We do delete the folder once test execution is completed. Ideally soapUI should look for script library in "rtc_4771" which is directory created for the current test cycle. I do set script library path in the load script. You can notice that statement highlighted in yellow color towards the bottom side.
I think [SoapUIProGroovyScriptEngineFactory] is using older path which has been updated in the soapui-seetings.xml file in the previous run.
Why is this happening? Please guide us how can we update library path in the soapui-settings.xml just at the beginning of the test so that it is picked up correctly?
Regards,
LIT
This post in no way reflect any Policies of Liberty Information Technology Ltd.
LIT
This post in no way reflect any Policies of Liberty Information Technology Ltd.
11 REPLIES 11
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2014
01:42 PM
07-02-2014
01:42 PM
Hi,
The script library can be changed dynamically by using the Setup Script area at the project level. Add the following in the Setup Script area.
When running test runner you should then see a message similar to this:
Wed Jul 02 16:38:00 EDT 2014:INFO:16:38:00,965 INFO [SoapUIProGroovyScriptEngineFactory] Resetting groovy class cache due to 3 modified files
16:38:00,966 INFO [SoapUIProGroovyScriptEngineFactory] Adding Script Library at [C:\My Script folder]
Regards,
Marcus
SmartBear Support
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
The script library can be changed dynamically by using the Setup Script area at the project level. Add the following in the Setup Script area.
project.scriptLibrary = "C:\\My script folder"
When running test runner you should then see a message similar to this:
Wed Jul 02 16:38:00 EDT 2014:INFO:16:38:00,965 INFO [SoapUIProGroovyScriptEngineFactory] Resetting groovy class cache due to 3 modified files
16:38:00,966 INFO [SoapUIProGroovyScriptEngineFactory] Adding Script Library at [C:\My Script folder]
Regards,
Marcus
SmartBear Support
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2014
04:46 AM
07-03-2014
04:46 AM
Hi Marcus
When you say Setup script area at the project level, is it which appears inside the "TestSuites" tab when we open project view?
I am not sure however when I add following code in that area:
The output log is shows incorrect folder as I had explained in the original post. I see the code written in this setup area is getting executed even after project load script.
This is similar situation. Am I doing anything wrong here?
When you say Setup script area at the project level, is it which appears inside the "TestSuites" tab when we open project view?
I am not sure however when I add following code in that area:
def text = "~"
def projectPath = context.expand( '${projectDir}')
project.scriptLibrary = projectPath + "/../../Setup"
log.info "${text*5} Project Setup Script -> Script Library path: "+project.scriptLibrary
The output log is shows incorrect folder as I had explained in the original post. I see the code written in this setup area is getting executed even after project load script.
This is similar situation. Am I doing anything wrong here?
Regards,
LIT
This post in no way reflect any Policies of Liberty Information Technology Ltd.
LIT
This post in no way reflect any Policies of Liberty Information Technology Ltd.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2014
07:26 AM
07-03-2014
07:26 AM
Hi,
Correct.
The project.scriptLibrary call is working for me to set the script library path, you may need to use an absolute path (one without the /../ in it) for the library path to be set correctly. Also, in your "Project Load Script", how is this being executed? Is this a script that is in an event handler?
Regards,
Marcus
SmartBear Support
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
When you say Setup script area at the project level, is it which appears inside the "TestSuites" tab when we open project view?
Correct.
The project.scriptLibrary call is working for me to set the script library path, you may need to use an absolute path (one without the /../ in it) for the library path to be set correctly. Also, in your "Project Load Script", how is this being executed? Is this a script that is in an event handler?
Regards,
Marcus
SmartBear Support
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2014
06:24 AM
07-04-2014
06:24 AM
Absolute path will not be possible as base path can not be determined at each developers machine. I think absolute path should not be an issue because I use it in load script and groovy steps to read test data which works OK.
I was setting up script path (at the preference level) in the load script as below. When you told about Project setup script, I commented it out in the load script and added new code in the setup script.
The output log after adding code in setup script is much same.
I expect soapUi to use path circled in green however it sets up path circled in red. I am sure soapUI is reading this from the soapui-setting.xml. It will have always entry of a path just one older to current run.
I was setting up script path (at the preference level) in the load script as below. When you told about Project setup script, I commented it out in the load script and added new code in the setup script.
// Setting Script Library
String scriptPath = projectPath + "/../../Setup"
SoapUI.settings.setString( SoapUIProSettings.SCRIPT_LIBRARY, scriptPath )
log.info "${text*10} Script Library: " + SoapUI.settings.getString( SoapUIProSettings.SCRIPT_LIBRARY, "Script Library")
The output log after adding code in setup script is much same.
I expect soapUi to use path circled in green however it sets up path circled in red. I am sure soapUI is reading this from the soapui-setting.xml. It will have always entry of a path just one older to current run.
Regards,
LIT
This post in no way reflect any Policies of Liberty Information Technology Ltd.
LIT
This post in no way reflect any Policies of Liberty Information Technology Ltd.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2014
06:44 AM
07-04-2014
06:44 AM
One thing I noticed that after I commented code in the load script and added new script in the Setup script, soapui.settings.xml file has not been updated. Every time soapUI is looking for script library in the older path. I am not sure the code added in Setup Script which file it updates. I checked settings.xml at the project level however could not find anything related to the library path in that file.
Regards,
LIT
This post in no way reflect any Policies of Liberty Information Technology Ltd.
LIT
This post in no way reflect any Policies of Liberty Information Technology Ltd.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2014
08:09 AM
07-07-2014
08:09 AM
Now my next experiment is in the project load script to clear out global script library path before setting it up again fresh. This is done because in each run the folder structure will be dynamic. I read on one of the other threads that it has helped few folks.
Now the code in the load script is like this:
The log statement that I see is as below:
Again same behavior. The script path is correctly set by the statements in load script however soapUI picks up old path entry from the soapui-settings.xml file before statements in load script which sets up the library path are executed. As I can see soapUIProGroovyScriptEngine class picks up the old path. Can you explain us how can we solve so that soapUI will always pick up latest path?
Again to reiterate I am running automated tests headless and not in the GUI client.
Now the code in the load script is like this:
//Make sure global setting is cleared
log.info "${text*10} Clearing global script library..."
com.eviware.soapui.SoapUI.settings.setString( "Script Library", "");
log.info "${text*10} Global script Library : '"+com.eviware.soapui.SoapUI.settings.getString( "Script Library","default")+"'"
// Setting Script Library
SoapUI.settings.setString( SoapUIProSettings.SCRIPT_LIBRARY, projectPath + "/../../Setup/Scripts" )
log.info "${text*10} Script Library: " + SoapUI.settings.getString( SoapUIProSettings.SCRIPT_LIBRARY, "Script Library")
The log statement that I see is as below:
Again same behavior. The script path is correctly set by the statements in load script however soapUI picks up old path entry from the soapui-settings.xml file before statements in load script which sets up the library path are executed. As I can see soapUIProGroovyScriptEngine class picks up the old path. Can you explain us how can we solve so that soapUI will always pick up latest path?
Again to reiterate I am running automated tests headless and not in the GUI client.
Regards,
LIT
This post in no way reflect any Policies of Liberty Information Technology Ltd.
LIT
This post in no way reflect any Policies of Liberty Information Technology Ltd.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2014
07:59 AM
07-09-2014
07:59 AM
Dear soapUI Support
Can anyone pick up this one?
Can anyone pick up this one?
Regards,
LIT
This post in no way reflect any Policies of Liberty Information Technology Ltd.
LIT
This post in no way reflect any Policies of Liberty Information Technology Ltd.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2014
09:35 AM
07-09-2014
09:35 AM
This sounds like a feature request to me. If I got this right, you are trying to overwrite the script library path in preferences?
Regards,
Temil
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Regards,
Temil
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2014
03:18 AM
07-14-2014
03:18 AM
This is not a feature request. Could you revisit my posts and let me know if something is unclear to you.
Regards,
LIT
This post in no way reflect any Policies of Liberty Information Technology Ltd.
LIT
This post in no way reflect any Policies of Liberty Information Technology Ltd.
