I want to try out user defined keywords as setup and teardown for test cases in a Robot Framework test suite and sub-test suites. I have following structure,
ROOT
|
|- tests
|- __init__.txt
|- sample.robot
__init__.txt contains the following text
*** Settings ***
Test Setup My Keyword1
Test Teardown My Keyword2
*** Keywords ***
My Keyword1
Log Inside My Keyword1
My Keyword2
Log Inside My Keyword2
Sample.robot contains following code,
*** Test Cases ***
My Testcase1
Log Inside My Testcase1
Running robot tests gives me the following error,
==============================================================================
Tests
==============================================================================
Tests.Sample
==============================================================================
My Testcase1 | FAIL |
Setup failed:
No keyword with name 'My Keyword1' found.
Also teardown failed:
No keyword with name 'My Keyword2' found.
------------------------------------------------------------------------------
Tests.Sample | FAIL |
1 critical test, 0 passed, 1 failed
1 test total, 0 passed, 1 failed
==============================================================================
Tests | FAIL |
1 critical test, 0 passed, 1 failed
1 test total, 0 passed, 1 failed
==============================================================================
Can you please let me know what am I missing in the above structure? I need a mechanism which will allow me to execute a user keyword as setup or teardown for default. Also if required an individual test case can override the setup/teardown.