Forum Discussion

JohnZ's avatar
JohnZ
New Contributor
13 years ago

set Datasource file name from an env variable

Hey,

Is it possible to set the datasource file name based on an environment variable? I tried the groove script but it doesn't seem to like it. What is the best option to do this?

Thanks!

3 Replies

  • nmrao's avatar
    nmrao
    Icon for Champion Level 1 rankChampion Level 1
    You are free to set any environment variable and access it in groovy script. For eg:

    def env = System.getenv()
    def soapuiHome = env['SOAPUI_HOME']
  • JohnZ's avatar
    JohnZ
    New Contributor
    How could I use this to set the file name for the data source?
  • nmrao's avatar
    nmrao
    Icon for Champion Level 1 rankChampion Level 1
    Gave an example. What is your use case? The question asked was
    Is it possible to set the datasource file name based on an environment variable

    Use above example to access environment variables in groovy script.