-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Each *** Variable ***
evaluation is done only once
#3974
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
Comments
Do I get it right that you get With "if variable is empty" do you mean variable having an empty string or possibly Do you have a more concrete example about what you actually are trying to do? |
Hmm - seems the screenshots are a bit off from what I am reporting 😅. I'll run them again.
Yes
I am trying to have a quick-and-dirty way of configuring slowMo https://marketsquare.github.io/robotframework-browser/Browser.html#New%20Browser.
|
I think the reason that first variable declaration "wins" is that it makes handling variables in resource files easier. Variables in the test case are parsed first, and thus variables in possible resource files cannot overwrite them. This whole design is actually pretty bad, we should have separate variable namespaces for resource files instead of having all variables in one store. I hope we get all that rewritten sometime in the future and then this could change. Anyway, I don't see much point in declaring same variable multiple times in one place and thus don't think it really matters which one of them is actually used. |
I don't see the point either, but this *** Settings ***
Documentation Variables evaluation
Suite Setup Log slowMo=${SLOWMO_VAL}
*** Variables ***
# ${SLOWMO_VAL} 0.0625
*** Test Cases ***
A
Sleep 0 will result in an error 😕 |
Being able to give a default value for a variable would be handy and such support was actually added to environment variables in RF 3.2 (#3382) using syntax
|
The current way to handle this situation is creating the variable so that it has the default value set. For example,
Then that value can be overridden fro the CLI using
Although this works fine, being able to specify the default value where the variable is used would be more convenient. |
If you @stdedos think being able to specify default values using |
I'd never use |
I doubt |
*** Variables ***
evaluation order is inverse*** Variable ***
evaluation is done only once
#4712 proposes variable defaults as well. I close this as its duplicate. |
Uh oh!
There was an error while loading. Please reload this page.
vs
Use case: I don't know (or don't remember) if there is a shorthand ala bash for "if variable is empty then replace with ..." functionality (i.e.
${SLOWMO:-0}
) in Robot Framework.None of the:
seem to work if I remove/comment out all the
*** Variables ***
(feel free to expand the list)The text was updated successfully, but these errors were encountered: