Created
April 17, 2014 09:53
-
-
Save aaira-a/10969876 to your computer and use it in GitHub Desktop.
Robot Framework variable file in Python, accessed using extended syntax from test case file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class database(object): | |
def __init__(self, env): | |
if env == 'test': | |
self.name = str('test mysql 1') | |
self.host = str('1.1.1.1') | |
self.port = str('11') | |
self.login = str('testlogin') | |
self.password = str('testpass') | |
elif env == 'beta': | |
self.name = str('beta mssql 2') | |
self.host = str('2.2.2.2') | |
self.port = str('22') | |
self.login = str('betalogin') | |
self.password = str('betapass') | |
elif env == 'prod': | |
self.name = str('prod aws 3') | |
self.host = str('3.3.3.3') | |
self.port = str('33') | |
self.login = str('prodlogin') | |
self.password = str('prodpass') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*** Setting *** | |
Variables connectionstrings.py | |
*** Variables *** | |
${env} test | |
${DB} ${database('${env}')} | |
*** Test Case *** | |
My Test Case 1 | |
Sleep 1s | |
Log To Console ${DB.name} | |
Log To Console ${DB.host} | |
Log To Console ${DB.port} | |
Log To Console ${DB.login} | |
Log To Console ${DB.password} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment