Robotframework keyword tags

1,583 views
Skip to first unread message

cp

unread,
Feb 20, 2019, 1:51:16 PM2/20/19
to robotframework-users
Per the documentation:
http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#user-keyword-tags 

Here it states that keyword tags will show up in the logs.  
However, when I add the tag to keywords, i do not see them in the report or log.  Anyone having this issue or have a solution?

If I use the builtin keyword "set tags" it works but unfortunately this cannot be used in teardown.


Tatu Aalto

unread,
Feb 21, 2019, 1:59:46 AM2/21/19
to cbp...@gmail.com, robotframework-users
Ugh

It has been awhile since I did play with the keyword tags, but back then they did work. Would it be possible to get a simple example, which we all can run, which demonstrates the problem you are having? Also with log.html attached.

-Tatu
Send from my mobile

--
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 https://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.

cp

unread,
Feb 21, 2019, 5:01:49 PM2/21/19
to robotframework-users
A sample would be something like:
*** Keywords ***
First Keyword
[Tags] keyword_1
Log Keyword1

Second Keyword
[Tags] keyword_2
Log Keyword2

*** Test Cases ***
Test Case 1
First Keyword

Test Case 2
Second Keyword

When ran, the log (attached) shows nothing for "Statistics by Tags" section.  
However, when I drill down into the test itself, when the keyword is called, it does print out the below:
Tags:keyword_1

Though I think it should also show up in the  "Statistics by Tags" section.   If you add "set tags" then it shows up in the section except the constraint is that I cannot use the keyword inside a teardown if I use "set tags".  

CP
Screen Shot 2019-02-21 at 1.54.17 PM.png

Pekka Klärck

unread,
Feb 21, 2019, 5:09:22 PM2/21/19
to Chieu Pham, robotframework-users
Stats by tags shows test case tags. Keyword tags are seen in log files under the executed kw.

Sent from my mobile.

cp

unread,
Feb 21, 2019, 5:17:19 PM2/21/19
to robotframework-users
Thanks for the clarifications Pekka! 

Do you think that it would be beneficial to have these keyword tags show up in the Stats by tags?   Having them just logged under the keyword execution does not seem that useful.  

An example is, if i have a keyword that covers a specific api call say (get uri/getUserProfile) I want to tag the keyword with tag "getUserProfile" and later on be able to identify how many tests that I have that covers that specific call from the reports. 

I have been using the keyword "Set Tags" to achieve this.  But now I am running into a situation where I cannot use keywords that use "Set Tags" in teardown.  Is there a specific reason why we are restricting this in Tear Down?  

CP



On Wednesday, February 20, 2019 at 10:51:16 AM UTC-8, cp wrote:

Pekka Klärck

unread,
Feb 22, 2019, 5:51:18 AM2/22/19
to Chieu Pham, robotframework-users
No, I don't think it's a good idea to show also kw tags in statistics in logs and reports. At least they shouldn't be combined with test tags. You can, however, pretty easily collect information about kw tags by using `robot.result` APIs programmatically.

Could you clarify what was the problem with Set Tags?

Sent from my mobile.

cp

unread,
Feb 22, 2019, 1:21:32 PM2/22/19
to robotframework-users
Per documentation for keyword "Set Tags" 

Adds given tags for the current test or all tests in a suite.

When this keyword is used inside a test case, that test gets the specified tags and other tests are not affected.

If this keyword is used in a suite setup, all test cases in that suite, recursively, gets the given tags. It is a failure to use this keyword in a suite teardown.

The current tags are available as a built-in variable @{TEST TAGS}.

See Remove Tags if you want to remove certain tags and Fail if you want to fail the test case after setting and/or removing tags.


Everything is fine until you use a keyword that contains "Set Tags" inside of a suite teardown.  I'm curious why it is allowed in suite setup but specifically set to fail in suite teardown. 

Thanks.
CP 

On Wednesday, February 20, 2019 at 10:51:16 AM UTC-8, cp wrote:

Pekka Klärck

unread,
Feb 22, 2019, 2:44:18 PM2/22/19
to Chieu Pham, robotframework-users
When suite teardown is executed, tests in that suite are already run and all information related to them is written to output.xml. It would require some extra logic to be able to modify tags at that point. So far nobody has considered it worth the effort to implement it.

Sent from my mobile.

Reply all
Reply to author
Forward
0 new messages