--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at http://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.
Ugh
But if your needs happen to be complex, one can create variables dynamically [1] from variable file [2]. But if your needs are similar to Bryan, I would definitely go with his approach.
-Tatu
Send from my mobile
[1] http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#getting-variables-from-a-special-function
[2] http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#variable-files
def getBaseURL(env):
if env == 'test':
domain = 'test.domain.com'
elif env == 'beta':
domain = 'beta.domain.com'
elif env == 'prod':
domain = 'www.domain.com.'
return 'http://' + domain*** Settings ***
Variables ../path/to/environment.py
*** Variables ***
${wwwPath} ${getBaseURL('${env}')}
*** Settings ***
Resource ../path/to/global_resource.txt
*** Test Cases ***
Test Case 1
Open Browser ${wwwPath}
pybot --variable env:prod --exclude testenv-only /path/to/tests/
pybot --variable env:beta /path/to/tests/
*** Test Cases ***
Test Case 1 Not Ready On Prod
[Tags] testenv-only
Test Case 2 To Be Tested On Prod
*** Settings ***
Force Tags testenv-only
def get_variables(env):
devparams = {"variableNL":"http://blob.dev.net",
"variableFR":"http://blobfr.dev.net",
}
testparams = {"variableNL":"http://blob.test.net"}
stageparams = {"variableNL":"http://blob.stage.net"}
prodparams = {"variableNL":"http://blob.net" }
if env == 'dev':
return devparams
elif env == 'tst':
return testparams
elif env == 'stage':
return stageparams
elif env == 'prod':
return prodparams
*** Settings ***
Variables environment.py dev
*** Variables ****** Settings ***
Resource ../../GlobalResource.robot
*** Test Cases ***
Use Global variables
Log ${variableNL}
Starting test: Robotframework.Testsuites.Sandbox.Sandbox.Use Global variables
20141211 16:46:18.036 : INFO : http://blob.dev.net
def get_variables(env):
devparams = {"param:value-dev"}
testparams = {"param:value-test"}
stageparams = {"param:value-stage"}
prodparams = {"param:value-prod"}
if env == 'dev':
return devparams
elif env == 'tst':
return testparams
elif env == 'stage':
return stageparams
elif env == 'prod':
return prodparams
*** Settings ***
Variables environment.py stage
*** Variables ***
Ugh
My test environment is growing and I need to take similar approach. I did write small prototype and for me it did work well. My pybot command does look like this:
pybot --variablefile /path/to/variable.py:dev example.robot
I did test in *nix and windows os and the result was same in both os.
-Tatu
Send from my mobile
--
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.