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

21 visualizzazioni
Passa al primo messaggio da leggere

Geist Eng

da leggere,
31 lug 2022, 23:49:5531/07/22
a 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

da leggere,
1 ago 2022, 00:10:3501/08/22
a 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

da leggere,
1 ago 2022, 02:22:1701/08/22
a 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

da leggere,
1 ago 2022, 05:01:3901/08/22
a 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. 

Rispondi a tutti
Rispondi all'autore
Inoltra
0 nuovi messaggi