'Variable file usage with Robot Framework and Python
If I create a variable file (var.py) and start my robot test:
robot --variablefile var.py[:set1]
.\test_this.robot
How can I use this variables in my other file (settings.py) what is called from Robot Framework test?
The goal is to start test and enter the environment I want to use (get from var.py file) and use that selection in settings.py
Do I need to pass the selection with parameter when calling settings.py file or can I use/read the var.py file directly from settings.py?
Solution 1:[1]
I solved this by using this in .robot Run Keyword If '${VAR}' == 'a' Import Variables ${CURDIR}/var_a.py
And this in .py BuiltIn().get_variable_value('${DBHOST}')
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | ZeroHero |
