Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unnecessary repetition when using VAR for already defined variable value #5105

Open
MarcinGmurczyk opened this issue Apr 5, 2024 · 0 comments

Comments

@MarcinGmurczyk
Copy link

Hi, please consider given example

*** Test Cases ***
Without VAR
    ${data}    Fetch Important Data
    Set Suite Variable    ${data}

With VAR
    ${data}    Fetch Important Data
    VAR    ${data}    ${data}    scope=SUITE


*** Keywords ***
Fetch Important Data
    RETURN    important data

We have a local variable ${data} which we want to promote to suite variable. Using keyword Set Suite Variable is pretty straightforward and clean. On the other hand when we're using VAR we need to use the same ${data} variable twice, first is the name of suite variable we want to create and second is the value of suite variable we want to create.

I propose such improvement
VAR ${data} scope=SUITE
If using VAR we pass only one positional argument threat this as a name and a value for the new variable

VAR ${not_yet_existing_variable}
What this line should produce? An error that it is not possible to fetch value from variable that is not defined or an empty variable named ${not_yet_existing_variable}?

VAR ${not_yet_existing_variable} ${EMPTY}
Creating empty variable should be explicit?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant