I have this snippet in my Keyword to store all ids in the test_id_list, but it doesn't seem to work as the latest test_id just overwrites the previous test_id, it does not add to the list.
${test_id} Get Value From JSON ${response} $.id
${test_id} Get From List ${test_id} 0
${test_id_list} Create List
Append to List ${test_id_list} ${test_id}
I have tried:
Removing the 3rd line and declare it like @{test_id_list}= Create List AND not removing the 3rd line but just changed it to "@{test_id_list}"
Overwriting happens because of the code above:
${test_id_list} Create ListSo, assume the
test_id_listis the test or global variable, and the code is run several times. Then, each time, it creates a brand new empty list and assigns it to the${test_id_list}variable, dropping the old list.As there is no bigger piece of your code, I could suggest superficially moving list creation out of this piece of code.
To illustrate the idea and imagining the list of responses, pseudo-code could look like: