[英]ROBOT FRAMEWORK: How to make test teardown execute only if test case fails?
[英]In Robot Framework, in the test case teardown phase, how to check whether the current test case is fail or pass?
在Robot Framework測試用例中,我們可以創建Teardown
階段來執行清理活動。
| *Test Case* |
| testcase1 |
| | [Setup] | Setup Actions |
| | Do Something | Args |
| | Do Something | Args |
| | [Teardown] | Teardown Actions |
| *Keyword* |
| Teardown Actions |
| | Do Something | Args |
| | Do Something | Args |
在Teardown
階段,我們如何檢查當前的測試用例是通過還是失敗?
我想在測試用例通過時做點什么,而在測試用例失敗時做點其他事情。
有一個名為${TEST_STATUS}
的變量可以在拆卸中使用。 這記錄在用戶指南的“ 自動變量 ”部分中。
您還可以使用諸如Run關鍵字(如果測試通過)和Run關鍵字(如果test失敗)之類的關鍵字 ,它們也只能在拆解中起作用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.