How do you add tags to data-driven tests in Robot Framework?

Anders Martinson picture Anders Martinson · Mar 11, 2014 · Viewed 21.4k times · Source

I am trying to add tags to data-driven tests in Robot Framework. I have created keywords for the templatized tests and tables for the data similar to the following:

# Test case file
*** settings ***
Resource       libraries.txt
Test Template  My Test Template

*** test cases ***       parameter1   parameter2  ER
testa                    value1a      value2a     ERa
testb                    value1b      value2b     ERb

# Template file
*** Keywords ***
My Test Template
  [Arguments]  ${parameter1}  ${parameter2}  ${ER}
  ${result}=  Do Something  ${parameter1}  ${parameter2}
  Should Be Equal As Strings  ${result}  ${ER}

How can I add (possibly distinct) tags for testa and testb?


It turned out to be PEBKAC. I was not indenting the tag statement. Those double spaces did me in (again).

Answer

Dmitriy Zverev picture Dmitriy Zverev · Mar 11, 2014

Tags can be added like this:

*** test cases ***       parameter1   parameter2  ER
testa                    value1a      value2a     ERa
    [Tags]    tag1
testb                    value1b      value2b     ERb
    [Tags]    tag1