Reputation: 125
I am working on a Python library and test suite for testing particular pieces of hardware by using Robot Framework. At that point, I have enough test cases to think about splitting them into several files or even test suites, so I went to the User Guide and found Test Suite Directories section.
Following the description, I have created following directory structure:
MyPythonLib\
MyPythonLib.py
...
MyTestSuite\
__init__.robot
01_FirstSetOfTests.robot
02_SecondSetOfTests.robot
Common.robot
The __init__.robot
file contains my settings:
*** Settings ***
Library Dialogs
Library Collections
Resource ../Common.robot
Library ../MyPythonLib/MyPythonLib.py
*** Keywords ***
Some Keywords Specified Here
Then I run the test suite by specifying directory instead of a file, like this:
robot MyTestSuite
When doing so, it does not recognize keywords specified in __init__.robot
file, as well as others. Since all of the settings are taken away from test case files, as I expected them to be included with the __init__
file, this makes me question if the directories are parsed as I understand they should. What am I doing wrong and how can I solve that issue?
Upvotes: 3
Views: 3661
Reputation: 386342
The behavior you describe is documented behavior.
From the robot framework user guide (emphasis added):
Variables and keywords created or imported in initialization files are not available in the lower level test suites. If you need to share variables or keywords, you can put them into resource files that can be imported both by initialization and test case files.
Upvotes: 2