|
| 1 | +# SPDX-FileCopyrightText: 2026 SAP SE or an SAP affiliate company and Greenhouse contributors |
| 2 | +# SPDX-License-Identifier: Apache-2.0 |
| 3 | + |
| 4 | +*** Settings *** |
| 5 | +Library Collections |
| 6 | + |
| 7 | +*** Keywords *** |
| 8 | +Test teardown init |
| 9 | + [Documentation] Initialize a list of teardown actions which can be executed by 'Test teardown run' automatically as long as it is put into Test teardown field. Run this init in setup or case steps |
| 10 | + Variable should not exist ${test_teardown_stack} Test teardown init: test_teardown_stack already defined!!! |
| 11 | + @{test_teardown_stack} Create list |
| 12 | + Set test variable ${test_teardown_stack} |
| 13 | + |
| 14 | +Test teardown run |
| 15 | + [Documentation] Get list objects from list '*${test_teardown_stack}*', and then execute these list objects (keyword and its arguments) one by one. Failure will be ignored so all list object can be executed. |
| 16 | + ${status} Run keyword and return status Variable should exist ${test_teardown_stack} Test teardown run: test_teardown_stack not defined!!! Run 'Test teardown init' in setup or case. |
| 17 | + Return from keyword if ${status} != True |
| 18 | + Log ============== Test teardown run start =============== |
| 19 | + FOR ${item} IN @{test_teardown_stack} |
| 20 | + ${status} ${return_value} Run keyword and ignore error @{item} |
| 21 | + Log ${item[0]} status:::${status}, return:::${return_value} |
| 22 | + END |
| 23 | + Log ============== Test teardown run end =============== |
| 24 | + |
| 25 | +Test teardown append |
| 26 | + [Arguments] @{keyword_and_args} |
| 27 | + [Documentation] *@{keyword_and_args}*: the list of keyword and its arguments |
| 28 | + Variable should exist ${test_teardown_stack} Test teardown add: test_teardown_stack not defined!!! Run 'Test teardown init' in setup or case. |
| 29 | + @{kw_args} Create list @{keyword_and_args} |
| 30 | + Append To List ${test_teardown_stack} ${kw_args} |
| 31 | + |
| 32 | +Test teardown add head |
| 33 | + [Arguments] @{keyword_and_args} |
| 34 | + [Documentation] *@{keyword_and_args}*: the list of keyword and its arguments |
| 35 | + Variable should exist ${test_teardown_stack} Test teardown add head: test_teardown_stack not defined!!! Run 'Test teardown init' in setup or case. |
| 36 | + @{kw_args} Create list @{keyword_and_args} |
| 37 | + Insert into list ${test_teardown_stack} 0 ${kw_args} |
| 38 | + |
| 39 | +Test teardown insert |
| 40 | + [Arguments] ${insert_position}=0 @{keyword_and_args} |
| 41 | + [Documentation] *${insert_position}*: like 0 (the first), -1(the reversed second), -2(the reversed third), and so on. |
| 42 | + ... |
| 43 | + ... *@{keyword_and_args}*: the list of keyword and its arguments |
| 44 | + Variable should exist ${test_teardown_stack} Test teardown insert: test_teardown_stack not defined!!! Run 'Test teardown init' in setup or case. |
| 45 | + @{kw_args} Create list @{keyword_and_args} |
| 46 | + Insert into list ${test_teardown_stack} ${insert_position} ${kw_args} |
| 47 | + |
| 48 | +Keyword teardown init |
| 49 | + [Documentation] Initialize a list of teardown actions which can be executed by 'Keyword Teardown Run' automatically as long as it is put into Keyword's Teardown field. Run this init in keyword steps |
| 50 | + #Variable should not exist ${keyword_teardown_queue} Keyword teardown init: keyword_teardown_stack already defined!!! |
| 51 | + @{keyword_teardown_queue} Create list |
| 52 | + Set test variable ${keyword_teardown_queue} |
| 53 | + |
| 54 | +Keyword teardown run |
| 55 | + [Documentation] Get list objects from list '*${keyword_teardown_stack}*', and then execute these list objects (keyword and its arguments) one by one. Failure will be ignored so all list object can be executed. |
| 56 | + ${status} Run keyword and return status Variable should exist ${keyword_teardown_queue} Keyword teardown Run: keyword_teardown_queue not defined!!! Run 'Keyword teardown init' in setup or case. |
| 57 | + Return from keyword if ${status} != True |
| 58 | + Log ============== Test teardown run start =============== |
| 59 | + FOR ${item} IN @{keyword_teardown_queue} |
| 60 | + ${status} ${return_value} Run keyword and ignore error @{item} |
| 61 | + Log ${item[0]} status:::${status}, return:::${return_value} |
| 62 | + END |
| 63 | + Log ============== Test teardown run end =============== |
| 64 | + @{keyword_teardown_queue} Create list |
| 65 | + |
| 66 | +Keyword teardown add head |
| 67 | + [Arguments] @{keyword_and_args} |
| 68 | + [Documentation] *@{keyword_and_args}*: the list of keyword and its arguments |
| 69 | + Variable should exist ${keyword_teardown_queue} Keyword teardown add head: keyword_teardown_queue \ not defined!!! Run 'Keyword teardown init' in setup or case. |
| 70 | + @{kw_args} Create list @{keyword_and_args} |
| 71 | + Insert Into List ${keyword_teardown_queue} 0 ${kw_args} |
| 72 | + |
| 73 | +Keyword teardown append |
| 74 | + [Arguments] @{keyword_and_args} |
| 75 | + [Documentation] *@{keyword_and_args}*: the list of keyword and its arguments |
| 76 | + Variable should exist ${keyword_teardown_queue} Keyword teardown append: keyword_teardown_queue not defined!!! Run 'Keyword teardown init' in setup or case. |
| 77 | + @{kw_args} Create list @{keyword_and_args} |
| 78 | + Append To List ${keyword_teardown_queue} ${kw_args} |
| 79 | + |
| 80 | +Keyword teardown insert |
| 81 | + [Arguments] ${insert_position}=0 @{keyword_and_args} |
| 82 | + [Documentation] *${insert_position}*: like 0 (the first), -1(the reversed second), -2(the reversed third), and so on. |
| 83 | + ... |
| 84 | + ... *@{keyword_and_args}*: the list of keyword and its arguments |
| 85 | + Variable should exist ${keyword_teardown_queue} Keyword teardown insert: keyword_teardown_queue \ not defined!!! Run 'Keyword teardown init' in setup or case. |
| 86 | + @{kw_args} Create list @{keyword_and_args} |
| 87 | + Insert into list ${keyword_teardown_queue} ${insert_position} ${kw_args} |
0 commit comments