How to set multiple keywords in one teardown or setup

8,449 views
Skip to first unread message

Xuan

unread,
Aug 20, 2012, 8:35:59 AM8/20/12
to robotframe...@googlegroups.com

I have examples here, the keyword 1 is only for that case, keyword 2 is a general keyword which I would like to apply for all cases.

  • Set Consumer Metadata Specified by Key JSON | /metadata | ${DEFAULT_FINGER_PRINT} | ${METADATA_KEY} | ${METADATA_VALUE}
  • Generic Test Case Teardown
If I set keyword "Generic Test Case Teardown" in the test suite's "test teardown", it is always overwritten by keyword1.

Any workaround or alternatives?

Mikko Korpela

unread,
Aug 20, 2012, 8:50:07 AM8/20/12
to robotframe...@googlegroups.com
Hi

Make a keyword that combines those two:

*** Settings ***
Test Teardown      Generic Test Case Teardown


*** Test Cases ***
Test
     [Teardown]       Specific Test Teardown
     Foo bar zoo

Another Test
     This one uses only the generic one

*** Keywords ***
Specific Test Teardown    
      Set Consumer Metadata Specified by Key JSON | /metadata | ${DEFAULT_FINGER_PRINT} | ${METADATA_KEY} | ${METADATA_VALUE
      Generic Test Case Teardown


Xuan

unread,
Aug 23, 2012, 11:01:53 AM8/23/12
to robotframe...@googlegroups.com
 It's a workaround I know. But anyways thanks Mikko!

Kevin O.

unread,
Aug 23, 2012, 1:57:08 PM8/23/12
to robotframe...@googlegroups.com
There is a keyword in BuiltIn that lets you run multiple keywords as long as they don't take arguments. It was created for scenarios just like this.

[Teardown]    Run Keywords    Specific Test Teardown | Generic Test Case Teardown

http://robotframework.googlecode.com/hg/doc/libraries/BuiltIn.html?r=2.7.3#Run Keywords

Stefan Lecho

unread,
Nov 30, 2012, 10:07:03 AM11/30/12
to robotframe...@googlegroups.com
Would it be possible to provide the Run Keywords If Test Failed keyword ?

Kevin O.

unread,
Nov 30, 2012, 2:52:54 PM11/30/12
to robotframe...@googlegroups.com
This would work:
Run Keyword If Test Failed    Run Keywords    kw1    kw2

Whatever happened with your SwingLibrary issue? I didn't see a new issue for JavalibCore.

Kevin

Stefan Lecho

unread,
Dec 3, 2012, 9:27:13 AM12/3/12
to robotframe...@googlegroups.com
The trick with Run Keywords is working. Thanks for you help.

The JavalibCore issues has been reported (and solved in the mean time) on https://github.com/robotframework/JavalibCore/issues/6.

N.T.

unread,
Apr 13, 2015, 4:33:32 AM4/13/15
to robotframe...@googlegroups.com
Sorry to bring up a old topic, but this is related to my question.

I currently have two keywords I want to run during setup. One of them has an argument. 

Here are the keywords (I wrote this on RIDE), which I hope to use for Test Setup but they don't seem to be working properly. 

Run Keywords Keyword1 Go to ${URL}

Upon running the log I get this error

20150413 13:14:10.894 :  FAIL : Keyword 'Selenium2Library.Go To' expected 1 argument, got 0.

Am not sure what am doing wrong, or if I should put an AND, but when I do  Robot Framework thinks it's a keyword. 

Tatu Aalto

unread,
Apr 13, 2015, 5:17:43 AM4/13/15
to Nicole Toledo, robotframework-users

Ugh

Reading the keyword documentation [1] should clear the issue.

-Tatu
Send from my mobile
[1] http://robotframework.org/robotframework/latest/libraries/BuiltIn.html#Run%20Keywords

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at http://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.

Laurent Bristiel

unread,
Apr 13, 2015, 10:09:34 AM4/13/15
to robotframe...@googlegroups.com
you can check this SO post as well: http://stackoverflow.com/a/22693082/1826804
Reply all
Reply to author
Forward
0 new messages