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.

2 Answers 2

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.

Sign up to request clarification or add additional context in comments.

Comments

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.