Hello, guys!
I would like to know if anyone could solve this doubt, because while the past weeks/months reading and learning about Robot Framework (and it has been a lot ) I barely can recall something related to that: reset variables.
The objective is to perform that action within Teardown or Setup just to avoid any Test Suite Variable or Global ones could keep former values and âcorruptâ the result of the Tests.
I would appreciate ideas, thoughtsâŚ
Thank you in advance!
Hi David,
The section of the doco that gives you the details you are after is variable scopes
Basically
- if you want the variable to be available to all test cases, set it as a global variable Set Global Variable
- if you want the variable to be available to all test cases in the suite only set it as a suite variable Set Suite Variable
- if you want the variable to be available to all keywords in this test case only use Set Test Variable
- if you want the variable to be only used in the current keyword and then no longer exist when the keyword ends use Set Local Variable
By default when you do something like ${variable}= My Keyword
you create a local variable, then you can use one of the keywords to change its scope.
No need to run a special keyword to remove all variables it will happen automatically when you change scope.
Dave.
1 Like
Hi Dave!
Youâre totally right. It was obvious and it was right there in the basic documentation. I am stack at some point after many many hours and my mind played some tricks related to variables dump.
Definitely I have to search where the problem is and discard this!
Thank you so much for such a valuable help!
1 Like