Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Teardown action in Robot Framework

I have a 3 test cases in robot framework and I need to run Teardown actions only Once at last after execution 3 test cases. How to handle?

*** Settings ***
Test Teardown     Teardown Actions
Library           abc.py

*** Variables ***

*** Test Cases ***
testcase1
    Run Keyword    func1

testcase2
    Run Keyword    func2

testcase3
    Run Keyword    func3


*** Keywords ***
Teardown Actions
    Run Keyword    clear
like image 443
passionTime Avatar asked Dec 18 '22 13:12

passionTime


1 Answers

There is "Suite Teardown" in robotframework which will run after the execution of all test cases.

Check this link for more info.

Can be use like this.

*** Settings ***
Library         SSHLibrary
Library         OperatingSystem
Library         String
Suite Teardown  Teardown Actions

*** Keywords ***
    Teardown Actions    
        Run Keyword clear

*** Testcases ***
    testcase1 
        Run Keyword func1

    testcase2 
        Run Keyword func2

    testcase3 
        Run Keyword func3

Please let me know if more info is required.

like image 184
Dinesh Pundkar Avatar answered Dec 28 '22 07:12

Dinesh Pundkar