Is it possible to add to test Setup/Teardown procedure in Robot Framework more than one keyword?
Asked
Active
Viewed 5,495 times
-1
-
possible duplicate of [How to make multi-lines test setup or teardown in RobotFramework without creating new keyword?](http://stackoverflow.com/questions/22691941/how-to-make-multi-lines-test-setup-or-teardown-in-robotframework-without-creatin) – Laurent Bristiel Jun 23 '15 at 19:28
-
If you read your suggested post, you can see that it doesn't work with arguments. So your suggest doesn't help. – user2988257 Jun 24 '15 at 13:20
-
@user2988257: your comment is puzzling, since the linked-to question clearly shows an example of keywords _with_ arguments. – Bryan Oakley Jun 24 '15 at 13:55
-
linked-to post is not worked for me until I figured out how to use it with pipes. the question was asked before that. thanks anyway – user2988257 Jun 24 '15 at 14:05
1 Answers
0
Yes. Use the Run Keywords keyword, and use the special argument AND
to separate your keywords.
For example:
*** Settings ***
| Test Setup | Run keywords
| ... | A keyword | with | arguments
| ... | AND | Another keyword | with | arguments
| ... | AND | One more keyword
Note that my use of the pipe-separated format isn't intended to imply that it's the only format you can use in this situation. You can use any supported format with this solution. For example, here is the same thing using the space-separated format:
*** Settings ***
Test Setup Run keywords
... A keyword with arguments
... AND Another keyword with arguments
... AND One more keyword

Bryan Oakley
- 370,779
- 53
- 539
- 685
-
The very important point is to add all the pipes between keywords and arguments. – user2988257 Jun 24 '15 at 13:16
-
@user2988257: I'm not sure what you mean by that. The pipes are only required for one particular format. You can just as easily do the same thing with space-separated, tab-separated, or any of the other formats. I just chose the pipe format because it makes it crystal clear where the cell boundaries are in the test case table. – Bryan Oakley Jun 24 '15 at 13:52
-
Tried all different ways and combination, the only way is with pipes that working for me. – user2988257 Jun 24 '15 at 14:03
-
@user2988257: rest assured, you can use the other formats. You must be doing something wrong, but without seeing your actual code it's impossible to know what mistake you're making. I've updated my answer to include an example in the space-separated format. – Bryan Oakley Jun 24 '15 at 14:22
-
@BryanOakley how do you do this using `[Teardown]` within the test case. [here's an example](http://pastebin.com/8cphzKJA) of what I've tried and what the results have been. Is this possible? – ewok Sep 17 '15 at 15:25
-
@ewok: Yes, it's possible. You do it exactly the same way. You are forgetting to use `Run Keywords`. – Bryan Oakley Sep 17 '15 at 15:38
-
1@BryanOakley I figured it out. I was missing the leading `...` before the first keyword. Thanks! – ewok Sep 17 '15 at 15:41
-
@BryanOakley one more question. When doing this in SETUP, is it possible to assign values to variables? [something like this](http://pastebin.com/YPhNmPPd) – ewok Sep 17 '15 at 16:28
-
@ewok: stackoverflow isn't designed for conversations. Plus, that question has already been asked and answered: http://stackoverflow.com/q/27792271/7432 – Bryan Oakley Sep 17 '15 at 17:17