How to make multi-lines test setup or teardown in RobotFramework without creating new keyword?

Kirill Zhukov picture Kirill Zhukov · Mar 27, 2014 · Viewed 30.3k times · Source

I need to call two teardown keywords in test case but must not create new keyword for that. I am interesting if there is a such syntax for keywords as for documentation or loops for example:

[Documentation]  line1
...              line2
...              line3

Answer

Laurent Bristiel picture Laurent Bristiel · Mar 27, 2014

Use the "Run Keywords" keyword.

From doc "This keyword is mainly useful in setups and teardowns when they need to take care of multiple actions and creating a new higher level user keyword would be an overkill"

Would look like that:

Test Case
  [Teardown]  Run Keywords  Teardown 1  Teardown 2

or also

Test Case
  [Teardown]  Run Keywords  Teardown 1  
  ...                       Teardown 2 

and with arguments

Test Case
  [Teardown]  Run Keywords  Teardown 1  arg1  arg2
  ...         AND           Teardown 2  arg1