Skip to content

Unable to use variable in keyword more than once : Variable '${arg1}' not found. #95

Description

@Avnish-Dewan

Hi,
I am facing an issue while using the variables more than once i.e. If I use a variable more than once in a keyword, it throws an error "Variable '${arg1}' not found.", whereas the first the variable is used , it works fine. I've attached the screenshots of the log files also:
image
image

Code:

*** Settings ***
Library            GeventLibrary

*** Test Cases ***
Example Test
    Log                 Hello
    Create Gevent Bundle    alias=alias1
    Add Coroutine       Task1  123  alias=alias1
    Add Coroutine       Task2   alias=alias1
    
    ${values}=          Run Coroutines    alias=alias1
    Log Many            @{values}

*** Keywords ***
Task1
    [Arguments]     ${arg1}
    Log    Task 1 started
    Log     ${arg1}
    Sleep    2
    Log     ${arg1}

Task2
    Log    Task 2 started
    Sleep    3
    Log    Task 2 finished
    RETURN   Task2

Here is the trace log for the error:

Traceback (most recent call last):
  File "src\\gevent\\greenlet.py", line 908, in gevent._gevent_cgreenlet.Greenlet.run
  File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\robot\libraries\BuiltIn.py", line 1853, in run_keyword
    return kw.run(self._context)
           ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\robot\running\model.py", line 77, in run
    return KeywordRunner(context, run).run(self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\robot\running\bodyrunner.py", line 76, in run
    return runner.run(step, context, self._run)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\robot\running\userkeywordrunner.py", line 68, in run
    return_value = self._run(context, kw.args, result)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\robot\running\userkeywordrunner.py", line 99, in _run
    raise exception
robot.errors.UserKeywordExecutionFailed: Variable '${arg1}' not found.
2023-06-01T10:36:28Z <Greenlet at 0x20909be8cc0: <bound method _RunKeyword.run_keyword of <robot.libraries.BuiltIn.BuiltIn object at 0x0000020908457B90>>('Task1', '123', '456')> failed with UserKeywordExecutionFailed

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions