Community rules list#

Community rules are optional rules that may handle specific issues or offer particular utility with certain limitations. All community rules are disabled by default and can be enabled by configuring enabled parameter:

robocop --configure sleep-keyword-used:enabled:True

or by including rule in --include:

robocop --include sleep-keyword-used

Keywords#

sleep-keyword-used / W10001#

Added in v5.0.0Supported RF versions: All

Message:

Sleep keyword with '{{ duration_time }}' sleep time found

Documentation:

Avoid using Sleep keyword in favour of polling.

For example:

*** Keywords ***
Add To Cart
    [Arguments]    ${item_name}
    Sleep    30s  # wait for page to load
    Element Should Be Visible    ${MAIN_HEADER}
    Click Element    //div[@name='${item_name}']/div[@id='add_to_cart']

Can be rewritten to:

*** Keywords ***
Add To Cart
    [Arguments]    ${item_name}
    Wait Until Element Is Visible    ${MAIN_HEADER}
    Click Element    //div[@name='${item_name}']/div[@id='add_to_cart']

It is also possible to report only if Sleep exceeds given time limit using max_time parameter:

robocop -c sleep-keyword-used:max_time:1min .

Configurable parameters:

Name

Default value

Type

Description

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

enabled

False

bool

Rule default enable status

max_time

0

timestr_to_secs

Maximum amount of time allowed in Sleep