Ask a Question

Load project level properties file using groovy?

SOLVED
richie
Community Hero

Load project level properties file using groovy?

Hey,

I was wondering if its possible to use groovy to load a properties file containing project level properties?

I found a post @nmrao answered (e.g. https://community.smartbear.com/t5/SoapUI-Open-Source/Loading-properties-from-file-via-Groovy/td-p/4...) and the way i interpret the response means you can load testcase level props (via a testcase level setup script) bit not project level props via groovy.

Is that correct....you cant load a project level props file via groovy?

Cheers,

Rich
if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
2 REPLIES 2
nmrao
Community Hero

If I understand right, you came up with based on the environment related question.

One can load the properties easily from UI. Of course, it is also possible to load from the script as well, but that requires property file path as input, at least needs to be changed. So, loading thru UI is very simple.

By the way, SoapUI / ReadyAPI loads the properties file by default, but the name and location are fixed.
Before invoking the tool, place the specific env properties into soapui.properties located under SOAPUI_HOME/bin; those properties automatically loaded.

If you still want script, then use same code at Project Setup script with below change. But you need to deal with property file path for that. Currently it was referring to Test case level.

Change from
testCase.setPropertyValue(it.key,it.value)

To
project.setPropertyValue(it.key,it.value)


Regards,
Rao.
richie
Community Hero

Hey @nmrao 

 

Yep!

 

I'm always gonna listen to advice fella - I just wanted the most efficient way of loading the properties and I thought a script would do it.

 

Appreciate all the help,

 

nice one,

 

rich

if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
cancel
Showing results for 
Search instead for 
Did you mean: