I have a robot test file that looks like
*** Test Cases ***
My Test
@{works}= Create List
... Do Work 1
... Do Work 2
FOR ${i} IN @{works}
Run Keyword ${i}
END
*** Keywords ***
Do Work 1
Log Hello
Do Work 2
Log World
Not Work 5
Fail
The @{works}
list needs to contain all keywords in this test file that start with “Do Work”. Currently I have to manually maintain it when a new keyword is added. Is there a way to automatically get all keyword names in robot framework? This way I can filter the keywords that start with “Do Work” and construct the @{works}
list automatically.
If possible, I want to avoid getting list of keywords by reading and parsing the test file. I hope that I can get the list from some data structure in robotframework’s Python runtime.