Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disallow using keyword with embedded arguments as normal keywords #1962

Closed
pekkaklarck opened this issue Apr 8, 2015 · 0 comments
Closed

Comments

@pekkaklarck
Copy link
Member

Keywords defined so that they contain embedded arguments can currently be used also as normal keywords so that the ${arg} part is just considered literal text. For example, these example pass:

*** Test Cases ***
Example without normal arguments
    Example ${keyword} w/o arguments

Example with normal arguments
    Example ${keyword} w/ arguments    first    second

*** Keywords ***
Example ${keyword} w/o arguments
    No operation

Example ${keyword} w/ arguments
    [Arguments]    ${arg1}    ${arg2}
    Log Many    ${arg1}    ${arg2}

If I remember correctly, the reason for this behavior was backwards compatibility. When embedded arguments functionality was introduced (#370), we didn't want to accidentally break anybody's keywords that just happened to contain ${foo} in their name.

We were recently reported an issue that was caused by this confusing behavior. It would be much simpler if keywords containing embedded arguments could only be used one way. In practice that would mean that the first example above would fail at execution time because ${keyword} variable is not defined in test case level. The second example should fail because it would be an error to create a keyword with both embedded arguments and normal arguments.

This change will also affect newly added functionality to create library keywords with embedded arguments (#1818). There trying to create a keyword with embedded arguments not matching actual function argument count should fail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant