You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that when "Set Suite Variable" is used with children=${True} in a suite setup and is then overwritten again within the the test case, the variable still has the old value when logged in a separate keyword. To better explain it, here's a simple test case to reproduce the error:
*** Settings ***
Suite Setup Test Suite Setup
*** Test Cases ***
Variable Test
Log ${test_variable}
Set Suite Variable \${test_variable} test case level content
Log ${test_variable}
Check Variable
*** Keywords ***
Test Suite Setup
Set Suite Variable \${test_variable} suite setup level content children=${True}
Log ${test_variable}
Check Variable
Check Variable
Log ${test_variable}
In the suite setup, the suite variable ${test_variable} is set using children=${True}. Logging the variable directly afterwards and additionally in the separate keyword "Check Variable" returns the correct value "suite setup level content".
Then in the test case, the suite variable is overwritten with "test case level content". Logging the variable before that step returns "suite setup level content" and after overwriting the variable the logging returns "test case level content" as expected.
However, when executing "Check Variable" again in the test case, the value is again "suite setup level content", so the old value instead of the new.
You may say now that the "children" parameter does not make sense to use on this level, but the same problem also occurs when I set the suite variable on a higher level in the init.robot file. Only because of simplicity I did it now in the suite setup of the same robot file. But nonetheless, using it on this level with the "children" parameter shouldn't lead to this behavior.
In fact, the issue happens even on multiple levels if there are more suite setups on different levels.
That means, if I set the suite variable in the init.robot file to the value "a", then execute "Check Variable" in the init.robot file, the value is "a" (as expected). Then in the "Test Suite Setup" keyword I set the value to "b", but "Check Variable" still returns "a". Then in the test case, I set the value to "c", but "Check Variable" returns this time "b", so always the value which was set "one layer above".
The text was updated successfully, but these errors were encountered:
pekkaklarck
changed the title
[BUG] "children" argument in "Set Suite Variable" keyword leads to wrong behavior in suite variable scope
Variables set using Set Suite Variable with children=True cannot be properly overwritten
Dec 19, 2023
Ought to be fixed now and the fix will be in RF 7.0 rc 1 that we plan to release tomorrow. It would be great if you @oetzus could validate the fix in your environment once the release candidate is out. If there still are problems, we can fix them before the final release.
I noticed that when "Set Suite Variable" is used with children=${True} in a suite setup and is then overwritten again within the the test case, the variable still has the old value when logged in a separate keyword. To better explain it, here's a simple test case to reproduce the error:
In the suite setup, the suite variable ${test_variable} is set using children=${True}. Logging the variable directly afterwards and additionally in the separate keyword "Check Variable" returns the correct value "suite setup level content".
Then in the test case, the suite variable is overwritten with "test case level content". Logging the variable before that step returns "suite setup level content" and after overwriting the variable the logging returns "test case level content" as expected.
However, when executing "Check Variable" again in the test case, the value is again "suite setup level content", so the old value instead of the new.
You may say now that the "children" parameter does not make sense to use on this level, but the same problem also occurs when I set the suite variable on a higher level in the init.robot file. Only because of simplicity I did it now in the suite setup of the same robot file. But nonetheless, using it on this level with the "children" parameter shouldn't lead to this behavior.
In fact, the issue happens even on multiple levels if there are more suite setups on different levels.
That means, if I set the suite variable in the init.robot file to the value "a", then execute "Check Variable" in the init.robot file, the value is "a" (as expected). Then in the "Test Suite Setup" keyword I set the value to "b", but "Check Variable" still returns "a". Then in the test case, I set the value to "c", but "Check Variable" returns this time "b", so always the value which was set "one layer above".
The text was updated successfully, but these errors were encountered: