Custom keywords do not support the [Setup] setting. Why?

18 views
Skip to first unread message

Geist Eng

unread,
Jul 31, 2022, 11:49:55 PMJul 31
to robotframework-users
After writing RF code for 7 years TIL custom keywords do not support the [Setup] setting.  They do support the [Teardown] setting.

Since I have never used this syntax might give some insight to why, but it seems there should be a reason since most every thing in RF has such. ;-)

User guide does not provide any feedback in this context.

User doc KW settings

Bryan Oakley

unread,
Aug 1, 2022, 12:10:35 AMAug 1
to robotframework-users
What do you mean by "do not support the [Setup] setting"? I use custom keywords in the setup quite often no problem. Can you give a short example where you're trying to use a custom keyword in a setup, and it doesn't work? 

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/robotframework-users/a33a99ce-6d5c-4e4a-8e4e-f46f630768c1n%40googlegroups.com.

Geist Eng

unread,
Aug 1, 2022, 2:22:17 AMAug 1
to robotframework-users
Good point.  Let me give example.  Below is a Keyword table from either a resource or test case file.  First KW is valid.  Second is not since it has a [Setup] setting.  The [Teardown] setting is valid in both:

*** Keywords ***
KW has all supported settings allowed
    [Arguments]    ${arg_name}
    [Documentation]    Some line of doc
    [Retun]    All good snafu
    [Tag]    Valid Keyword
    Log    Got argument ${arg_name}
    A custom keyword    ${arg_name}
    [Teardown]    Foo And Bar
    [Timeout]    ${when the Eagles play together again}

KW has all supported settings allowed and setup which is not supported
    [Setup]    Make foo with bar
    [Tag]    Not a valid keyword
    [Arguments]    ${arg_name}
    [Documentation]    Some line of doc
    [Return]    All good snafu
    Log    Got argument ${arg_name}
    A custom keyword    ${arg_name}
    [Teardown]    Foo And Bar 
    [Timeout]    10



Bartłomiej Hirsz

unread,
Aug 1, 2022, 5:01:39 AMAug 1
to bryan....@gmail.com, robotframework-users
I think the original question did not mean keywords in the setup, but using [Setup] in the keyword(which is not possible). Tests support setup/teardown and keyword only teardown afaik. 

Reply all
Reply to author
Forward
0 new messages