teak
9 years agoContributor
how to set environment variable to use in loadtestrunner
Hi,
i am trying to read an environment variable in a groovy script:
def host = context.expand('${#Env#API_HOST}')
i set the environment variable:
export API_HOST="https://api.host.com"
when i run:
echo $API_HOST
i get:
https://api.host.com
when i run the groovy script from soapui:
log.info context.expand('${#Env#API_HOST}')
i get null or an empty string.
when i run loadtestrunner with a step including:
def host = context.expand('${#Env#API_HOST}')
the host is still empty.
any idea on how i can resolve this?
am i setting the environment variable correctly?
am i trying to access the environment variable in the groovy script correctly?
any more info i can provide?
thanks a lot.
i started soapui from the terminal rather than the launhcer in os x and it worked.
i then ran loadtestrunner and it worked as well.
i had to start soapui from a session with the environment variable set first.