To perform multiple keywords in the Teardown Test method, use the following trick:
First, define a new keyword that contains the set of keywords that you want to run.
eg. here Failed Case Handle is the new definition of the other two keywords take screenshot and close application . Think about it, take a screenshot, and then close the running application.
Basically, when you call the Failed Case Handle keyword, take screenshot and close application will execute accordingly.
Then, in the ***Settings*** section, define the Test Teardown procedure in the following example.
*** Settings *** Test Teardown run keyword if test failed Failed Case Handle
or,
So, in the first case, the Failed Case Handle keyword will be called if any test case fails. On the other hand, in the second case, after each test case, the Failed Case Handle keyword will be called.
source share