我已經使用$ {TEST STATUS}(自動變量)獲取錯誤狀態。如何在Robot Framework中獲取當前測試用例的狀態通過/失敗
1
A
回答
1
有一個全局變量,稱爲${TEST_STATUS}
。您可以在teardown
部分使用它。
請參閱文檔中的相應部分Automatic Variables
。
http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#id514
4
你可以使用這個變量只有在拆解部分。如下面的例子。機器人保持兩個級別「測試水平」和「適合水平」。在測試內部還有另外兩件事叫做「設置」和「拆卸」。 設置意味着在執行它將運行的每個測試用例之前。和拆卸意味着在執行每個測試用例後它將運行。在執行Default_values之前的示例中,覆蓋設置,No_teardown等。測試用例Open_Application將運行,退出測試用例後,Close Application將運行。您只能按照文檔中所述和No_teardown測試用例中的說明在拆卸部分中使用該自動變量。在No_teardown測試用例中,它正在檢查它是否爲真。你可以根據你的需要改變任何東西。
*** Settings ***
Test Setup Open Application App A
Test Teardown Close Application
*** Test Cases ***
Default values
[Documentation] Setup and teardown from setting table
Do Something
Overridden setup
[Documentation] Own setup, teardown from setting table
[Setup] Open Application App B
Do Something
No teardown
[Documentation] Default setup, no teardown at all
Do Something
[Teardown] Should Be True '${TEST STATUS}' == 'True'
No teardown 2
[Documentation] Setup and teardown can be disabled also with special value NONE
Do Something
[Teardown] NONE
Using variables
[Documentation] Setup and teardown specified using variables
[Setup] ${SETUP}
Do Something
[Teardown] ${TEARDOWN}
這個例子修改這個機器人文檔鏈接的版本: - http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#test-setup-and-teardown
希望這將消除你的疑慮。
相關問題
- 1. Robot Framework獲取當前測試用例的名稱
- 2. 在Robot Framework中,在測試用例拆解階段,如何檢查當前測試用例是失敗還是通過?
- 3. 在Robot Framework中使用獲取時間測試用例
- 4. 如何獲得失敗並通過JUNIT測試用例的測試計數
- 5. 無法將測試用例轉入失敗狀態
- 6. 如何從Excel中獲取QC中的測試用例狀態?
- 7. 如何在UIAutomator中獲得通過和失敗測試用例數
- 8. 在調試過程中獲取對象的當前狀態
- 9. Robot Framework測試腳本失敗,出現SSLError
- 10. 如何在Java中獲取當前EC2實例狀態
- 11. 測試失敗:0通過,1失敗當使用JUnit測試我的方法
- 12. 要在Excel中打印通過/失敗狀態,經過編碼的UI測試
- 13. 如何在Robot Framework的測試用例中使用TRUE和PASS值?
- 14. 如何在RIDE Robot Framework中的不同源文件中保存測試用例?
- 15. 在Robot Framework中自動化測試用例
- 16. Robot Framework中已禁用的測試用例
- 17. 如果第一個testcase失敗,如何停止Robot Framework測試執行?
- 18. 通過谷歌地圖獲取當前的交通狀態
- 19. 在Bamboo中運行Robot Framework UI測試
- 20. 如何獲取Wave的當前狀態?
- 21. Ruby測試:單元,如何知道測試套件中每個測試用例的失敗/傳遞狀態?
- 22. Robot Framework:如何獲取元素的xpath?
- 23. 如何獲取當前scalajs/uTest測試用例的名稱
- 24. 如何在Robot Framework中運行小黃瓜樣式測試用例
- 25. 如何在Robot Framework中創建自定義測試用例設置
- 26. 獲取當前測試用例在Junit中運行的類
- 27. 如何在Angular4中獲取當前狀態的前一個狀態名稱?
- 28. 當py.test測試失敗時PyCharm可以進入調試狀態
- 29. 正確的測試案例執行給出'失敗'狀態
- 30. 如何在Robot Framework中保留對象狀態
你得到了什麼錯誤? –