2

I am Trying to set a List variable that is accessible to all testcases in the suite and the value in the list should not be overwritten but new values should be appended each time.

So that I can use the List variable at the end of the execution of all the testcases for a clean up operation.

For Example the List variable will be holding value of the record created in the DB and at the end I can use this list to delete all the records created. Note each record will be created by different testcases under the same Suite. Any help will be greatly appreciated.

Bence Kaulics
  • 7,066
  • 7
  • 33
  • 63
Bhuvaneshwari K
  • 147
  • 1
  • 15

2 Answers2

3

Declare the variable in the *** Variables *** section and it will be accessible in all cases; if you don't give a value to it during this initialization, it will be an empty list:

*** Variables *** 
@{my list}

Then just add any members you need in your cases:

Append To List    ${my list}    value

, and at the end - in the keyword set as Suite Teardown - you'll be able to iterate over it.

Todor Minakov
  • 19,097
  • 3
  • 55
  • 60
1

You can create this variable using keyword Set Suite Variable in each test your variable can be updated. If you want to update your variable on a global scale you can use Set Global Variable. You can have a look at the documentation for more information

Jiri Janous
  • 1,189
  • 1
  • 6
  • 14