xyb/robotframework-debuglibrary

Variables passed to Keywords are not accessible

Closed this issue · 4 comments

When you set the Debug statement inside of a Keyword, you cannot access the variable passed into the keyword inside the REPL debugger.

*** Keywords ***
Test REPL With Variables
    [Arguments]        ${var}
    Debug

=================

>>>>> Enter interactive shell, only accepted plain text format keyword.
> Log     ${var}
< keyword:  Log     ${var}
!  Non-existing variable '${var}'.

@bbbco You need a return value from keyword

[jollychang@WilliamMBP tmp]$ cat test_aaa.txt
*** Settings ***
Library         DebugLibrary
Library         String

*** Keywords ***
a
    [Arguments]    ${string}
    [Return]    ${rs}
    ${rs}=  get substring  ${string}  1  3

** test case **
SOME TEST
    a  '123'
    Debug

[jollychang@WilliamMBP tmp]$ pybot test_aaa.txt
==============================================================================
Test Aaa
==============================================================================
SOME TEST                                                             .
>>>>> Enter interactive shell, only accepted plain text format keyword.
> a  hello
<  'el'
>

But what if I want to debug inside of a Keyword and not inside of a test? That is the example I gave--the debug statement is inside the Keyword definition and not inside the test case. I should be able to access the variable that is passed in to the Keyword that I am debugging.

Please reopen and reconsider this issue.

xyb commented

@bbbco variable assignment supported now, please upgrade to version 0.8.

I cannot use any variables set at the start of a keyword from my Fedora 25 terminal, both from bash or sh. It always returns ! FAILED: ExecutionFailed(u"No keyword with name '${var}=' found.",).
However everything works fine in Windows 7 cmd and Alpine bash.
Any suggestions?