Search code examples
loggingtagsreportrobotframework

Keyword Tags under 'Statistics by Tag' in robot framework


I am working with robot framework and want to optimize the report and log window.

I add tags to my keywords in my robot script and I expected that these keywords would be list bellow 'Statistics by Tag'. But It didnt.

Example:

Robot script:

***Keywords***
FirstKeyword
   [Tags]   acceptance 
   Log      Keyword1

SecondKeyword
   [Tags]   acceptance 
   Log      Keyword2
  

***Test Cases***
Test1
   FirstKeyword

Test2
   SecondKeyword

Report/Log: enter image description here

How can I add my tagged keywords to 'Statistics by Tag' so that I can just list the keywords with the selected tag.

Thanks. Pouyan


Solution

  • Though keywords do support tagging, their purpose is different than what you intend - they are in the logs, and can be used for manipulating the html files produced from an output.xml, but they don't appear in the statistics section of the reports.

    Imagine if it was the other way around, and they were shown there, what info would they bring? Remember that a keyword is an operation, while a case is a combination of such to assert a behavior - and slicing cases by a tag is usually what users want to achieve.

    "Here are the stats on cases that had a specific operation in them" - what if that op was login, or navigation to a page in the SUT, or a DB assert; that would be just noise IMHO. A tag for verifying the page works as expected, or the system stores the data in DB correctly is the value, and that's achieved with tags on those specific cases.

    Plus, tags are very often used to run specific set of cases. If that was extended to keyword ones, the framework should do much heavier parsing on selecting what to run - not only on the suites & cases, but on the keywords they use, going as deep as needed for embedded ones.