cancel
Showing results for 
Search instead for 
Did you mean: 

Loading properties from file via Groovy

Frequent Contributor

Loading properties from file via Groovy

Hello,

I have defined several custom properties on test case level. Is it possible to call the "Load properties from file" functionality from a Groovy script? If yes, how can I do that?

Sincerely,
Robert
2 REPLIES 2
Community Hero

Re: Loading properties from file via Groovy

You can have do it with setup script for the test case.

1. Define a test case level property say PROPERTY_FILE_NAME and have absolute path of property file.
2. For the test case, do a double click, you can see Setup Script. Have below script.

def props = new Properties()
new File(context.expand('{#TestCase#PROPERTY_FILE_NAME}')).withInputStream {
stream -> props.load(stream)
}
props.each {
testCase.setPropertyValue(it.key,it.value)
}


This script will run each time when test case is invoked.


Regards,
Rao.
Community Hero

Re: Loading properties from file via Groovy

Looks you are a soapui pro user, try posting quries in pro boards for faster response.


Regards,
Rao.
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors