Question

*** Settings ***

*** Test Cases ***
Browser Shutdown

*** Keywords ***
Browser Shutdown
    Close Browser

file closebrowser.txt contains no keyword error shown when run this file. I just want to execute this file at the end of all test cases so that if browser is open this will close that

in closebrowser.txt i dont want to execute any test, only tear down the browser(s) after executing all the test.txt file in the folder. Since i can add one or more test file in the folder (e.g. test3.txt,test4.txt...) so instead of providing in these file i want a separate file which will run and close the browser

Was it helpful?

Solution 2

Create __init__.txt file to each of the directories and add

*** Settings ***
Suite teardown    Close all browsers

to the file. That will add suite teardown that will be run after any test suites in the directory. The __init__.txt is called an initialization file

OTHER TIPS

You can't call a Test Case in another Test Case.

You've three way to define TearDown

*** Settings ***
Test Teardown     Close All Browsers
Suite Teardown     Close All Browsers

*** Test Cases ***
My Test
    ...
    [Teardown]    Close All Browsers

Test Teardown and [Teardown] will be executed at the end of a every Test Case inside a Suite, Suite Teardown only at the end of the Suite.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top