Forum Discussion

richie's avatar
richie
Community Hero
6 years ago

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-Op...
  • nmrao's avatar
    6 years ago
    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)