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?
Test setup and teardown In short, a test setup is something that is executed before a test case, and a test teardown is executed after a test case. In Robot Framework setups and teardowns are just normal keywords with possible arguments. Setup and teardown are always a single keyword.
This is a set of keywords or instruction to be executed after the start of test suite or test case execution. We will work on a project setup, where will use both setup and teardown. The opening and closing of browser are the common steps in test cases.
A teardown test case will execute at the end of your test run within a test folder. Teardown test cases are used to perform post test execution actions. For example, a teardown test case can be used to delete test data generated during test execution.
To create test case, right-click on the project. Click New Test Case. Enter the name of the test case and click OK. There are 3 tabs shown for the test case created − Edit, Text Edit and Run.
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}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With