Resource files should only see keywords it imports itself directly or indirectly

Author: jesuspvCreated Apr 19, 2017Updated Sep 12, 2026
Labelspriority: criticalbackwards incompatibleeffort: extra large

Given the following files (one for a test case and two for resources):

$ cat cases/case.robot
*** Settings ***

Resource    rc/SSHClient.robot
Resource    rc/TelnetClient.robot

*** Test Cases ***

My Test Case
    SSHClient.Log On
    TelnetClient.Log On

    SSHClient.Log Off
    TelnetClient.Log Off
$ cat rc/SSHClient.robot
*** Variables ***

${SERVER_IP}    1.2.3.4
${SERVER_USER}    guest
${SERVER_PASSWORD}   guest

*** Settings ***

Library    SSHLibrary

*** Keywords ***

Log On
    Open Connection    ${SERVER_IP}
    Login    ${SERVER_USER}    ${SERVER_PASSWORD}

Log Off
    Close Connection
$ cat rc/TelnetClient.robot
*** Variables ***

${SERVER_IP}    1.2.3.4
${SERVER_USER}    guest
${SERVER_PASSWORD}   guest

*** Settings ***

Library    Telnet

*** Keywords ***

Log On
    Open Connection    ${SERVER_IP}
    Login    ${SERVER_USER}    ${SERVER_PASSWORD}
    ...    login_prompt=Username:
    ...    password_prompt=Password:

Log Off
    Close Connection

When running case.robot this kind of warning appears:

[ WARN ] Keyword 'Open Connection' found both from a custom test library 'SSHLibrary' and a standard library 'Telnet'. The custom keyword is used. To select explicitly, and to get rid of this warning, use either 'SSHLibrary.Open Connection' or 'Telnet.Open Connection'.
[ WARN ] Keyword 'Login' found both from a custom test library 'SSHLibrary' and a standard library 'Telnet'. The custom keyword is used. To select explicitly, and to get rid of this warning, use either 'SSHLibrary.Login' or 'Telnet.Login'.
My Test Case

which seems to force us to prefix keywords in the resource files with the library name, even when they have imported only one library (with no name collision in the resource-file scope).

Should not be the scope of keywords called in resource files determined locally to the resource file? (at least, when they can be resolved in the resource-file scope as when we have been explicitly imported the corresponding library)

P.S.: I know that it is intended that keywords can be resolved at runtime to allow dynamically decide the implementation (I do not remember where I read about that behaviour though). However, this seems to hamper Robot framework keywords reusability, forcing us to work around by prefixing keywords, renaming them (globally unique...!), or implementing these keywords in a .py file (to be imported via Library). Please, you can also consult this resource example in the official user guide for additional evidences on how misleading is the current non-local scope resolution.

Source: robotframework/robotframework