I have written a python function for fetching database credentials for different environments
def database_creds(env):
if env == 'staging' or env == 'qa':
hostname = 'host1'
username = 'user1'
password = 'pass11'
database = 'TestDb'
elif env == 'production':
hostname = 'host2'
username = 'user2'
password = 'pass22'
database = 'ProdDb'
return hostname, username, password, database
My doubt is how we can use each returned values in robot file?
If we are returning only one value from a python function
def getApiFullUrl(env):
if env== 'production':
url = 'production url'
else:
url = 'other environment url'
return url
we can use like this in robot file:
${url} ${getApiFullUrl('${env}')}
${result1} ${result2} = ${database_creds('${env}')?database_creds()is incorrect.