私は、PythonとRobotframeworkスクリプトの組み合わせを使って実装されたプロジェクトを持っています。Robotframeworkの構文解析
class MyConfigManager(ConfigManager):
"""
Class to hold all config values in form of variables.
"""
def __init__(self):
super().__init__("dispatch/config.ini")
self._android = Android(self._config)
@property
def username(self):
return self._config.get(_env_section, "Username")
@property
def password(self):
return self._config.get(_env_section, "Password")
config = MyConfigManager()
:Pythonは大丈夫のようCONFIGMANAGERオブジェクトを使用して上記の変数を解釈することができます
[Environment]
Username: [email protected]
Password: testpassword
[WebUI]
login_url: http://testsite.net/
:私は、構成アイテムの束が私のプロジェクト内でこのようになりますconfig.iniファイルを保存しています
Robotframeworkのconfig.iniを変数ファイルとしてインポートして、これらの値を使用することはできますか?私は自分のロボットスクリプトに別の変数ファイルを持たないようにしています。
EDIT:
私はロボットのファイルで、このような何かをしようとしています:変数のファイルがPythonコードすることができ、彼らのpythonているので、あなたはすべての変数を作成することができます
*** Settings ***
Documentation WebUI Login Tests
Library SeleniumLibrary
Resource common_keywords.robot
Variables config.ini
#^will this work?
Default Tags Smoke
Suite Setup Set Selenium Timeout 15seconds
Suite Teardown Close Browser
*** Variables ***
${login_button} class:auth0-lock-submit
*** Test Cases ***
TC001_Login_Test
[Documentation] Open login page, login with credentials in arguments.
Open Browser Confirm Login Page chrome ${login_url}
Provide Input Text name:email ${username}
Provide Input Text name:password ${password}
Find Element And Click ${login_button}
# the three vars ${login_url}, ${username}, ${password} would be from
# config.ini but this isnt working. What am I doing wrong? or is not
# possible to do this?