6
votes

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
have you read the robot framework user guide? It contains an explanation of how to use test setup and teardown, and includes examples.Bryan Oakley

1 Answers

16
votes

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}