Test Setup and Teardown for each test case in a test suite in Robot Framework using python

风格不统一 提交于 2020-12-30 09:39:11

问题


I'm new to Robot Framework. Can someone help me to find if it's possible to have to a test Setup and a Teardown for each test case in test suite containing around 20 test cases.

Can someone explain this with an example?


回答1:


Here's an example. A testsuite containing teardown. You can miss the teardown from each testcase if you want to execute it at last. Please read the corresponding documentation:

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}


来源:https://stackoverflow.com/questions/40101372/test-setup-and-teardown-for-each-test-case-in-a-test-suite-in-robot-framework-us

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!