使用python在机器人框架工作的测试套件中测试每个测试用例的设置和拆卸

时间:2016-10-18 06:49:12

标签: python robotframework

嗨,我是机器人框架工作的新手。有人可以帮我找到是否可能需要对包含大约20个测试用例的测试套件中的每个测试用例进行测试设置和拆解。

有人可以用一个例子来解释这个吗?

1 个答案:

答案 0 :(得分:7)

这是一个例子。包含拆卸的测试套件。如果你想最后执行它,你可以错过每个测试用例的拆解。 请阅读相应的文档:

http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#test-setup-and-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]

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}