I have a project that has been implemented using a mix of python and Robotframework scripts. I have have a bunch of configuration items stored inside my projects Config.ini file which looks like this:
[Environment]
Username: username@mail.com
Password: testpassword
[WebUI]
login_url: http://testsite.net/
Python is able to interpret the above variables alright using the ConfigManager object like this:
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()
Is it possible to import config.ini in Robotframework as a variables file and use these values? I am trying not to have another variables file for my Robot scripts.
EDIT:
I am attempting to do something like this with my robot file:
*** 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?