2016-10-17 53 views

回答

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

希望這將消除你的疑慮。

相關問題