I have defined test variable in variable section in imported resource file.
In the tests i am using it and catenating some string and returning to same variable.
Same test variable i have used in the teardown method. Still getting variable not in used error
From my point of view the problem lies in the fact that you’re using a keyword (Catenate from Built-in) in the variables section.
Here I assume RF is trying to define a simple variable with 3 values (Catenate, itself and Test).
I understand you have a resource file that you use somehow to build your variable, but you should define a keyword in your resource file, that could be called from robot files.
For example:
Custom Catenate
[Arguments] ${inputvar}
${outputvar} Catenate ${inputvar} Test
RETURN ${outputvar}
That would allow you to improve later the keyword, by example to provide list, manage separator or use conditional statement depending of your needs.
If you assign a variable in a test case or keyword then this variable belongs to the scope where it is assigned. Suite or global variables are not overriden, a new variable with the same name is defined. If you want that this variable should become available on suite scope then you have to use the VAR statement or the old Set Suite Variable keyword, like this:
*** Variables ***
${READ_LIST} value1
*** Test Cases ***
first
${READ_LIST} Catenate ${READ_LIST} value2
VAR ${READ_LIST} ${READ_LIST} scope=suite
# Set Suite Variable ${READ_LIST} ${READ_LIST}
[Teardown] teardown kw
*** Keywords ***
teardown kw
Log ${READ_LIST}
This is more like a warning from the plugin that you are using and not an error. If your company allows lint warnings then it should be fine orelse this is not an error from your part.