question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Keywords under Run Keywords are not recognized

See original GitHub issue

Keywords provided as arguments for Run Keywords are not recognized as keywords, thus do not support ‘go to declaration’ feature. I’m using PyCharm 2020.3.5 with RFLS plugin v0.11.1.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:10
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
xylixcommented, Aug 20, 2021

Just some of my personal thoughts on the technical side of why this is not exactly simple and why it currently works like it does:

This is of course partially thanks to the type of the upstream objects inputs’ being str and *args instead of the corresponding Keword or function.

https://github.com/robotframework/robotframework/blob/b68e2b689515446056e53edd67bc23c4c1fd8be0/src/robot/libraries/BuiltIn.py#L1856

In general properly typing Robot Framework’s higher order keywords would be quite interesting. And perhaps would also enable auto completion and validation for them when using python LSP when programming Robot.

But fixing it upstream is probably out of scope for Robot LSP. Most likely there are way easier ways to just figure out completion for them keyword-by-keyword for example. Perhaps by using the metadata from the @run_keyword_variant decorator that most such methods have. But that feature is supposed to be deprecated at some point https://github.com/robotframework/robotframework/issues/2190.

2reactions
HaaiHenkiecommented, May 2, 2021

The same is true for all Builtin keywords that run other keywords. Autocomplete and highlighting is also not supported for keywords that are used as argument.

*** Settings ***
Suite Teardown    Suite Teardown
Test Teardown     Test Teardown

*** Test Cases ***
Keywords running other keywords
    Repeat Keyword    5 times    No Operation
    Run Keyword    No Operation
    Run Keyword And Continue On Failure    No Operation
    Run Keyword And Expect Error    Error    Fail    Error
    Run Keyword And Ignore Error    Fail    Error
    Normal Return
    Conditional Return
    Run Keyword And Return Status    No Operation
    Run Keyword And Warn On Failure    No Operation
    Run Keyword If    ${true}    No Operation
    Run Keyword If    ${true}    No Operation
    ...    ELSE IF    ${true}    Sleep    4s
    ...    ELSE    Fail
    Run Keyword Unless    ${false}    No Operation
    Run Keywords    Sleep    4s
    ...    AND    No Operation
    Wait Until Keyword Succeeds    5s    1s    Sleep    4s

*** Keywords ***
Suite Teardown
    Run Keyword If All Tests Passed    No Operation
    Run Keyword If Any Tests Failed    No Operation

Test Teardown
    Run Keyword If Test Failed    No Operation
    Run Keyword If Test Passed    No Operation
    Run Keyword If Timeout Occurred    No Operation

Normal Return
    Run Keyword And Return    No Operation

Conditional Return
    Run Keyword And Return If    ${true}    No Operation
Read more comments on GitHub >

github_iconTop Results From Across the Web

Keywords not recognized - Robot Framework
Hi, I seem to have ran into some issues with my IDE (VSC and Pycharm) Even though I can run tests in my...
Read more >
':For' loop under 'Run Keywords' not recognized even after ...
Now here in a certain condition, my code has a for loop which isn't recognised by Run Keywords. Any help would get me...
Read more >
Keywords not recognized in Visual Studio Code
Keywords are nor recognized with the Robocorp Visual Studio Code extension. It's does not detect keywords and variables from .robot and .py ...
Read more >
Robotframework - error when using Run Keyword If /ELSE
But I always get error: 'Else' is a reserved keyword. It must be in uppercase (ELSE) when used as a marker with 'Run...
Read more >
BuiltIn - Keyword Documentation - Robot Framework Hub
Many keywords, such as `Evaluate`, `Run Keyword If` and `Should Be True`, accept an expression that is evaluated in Python. These expressions are...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found