Using Tags Declared in xls Datasheet

Basically exactly what the title says. I have a datasheet in excel that I am using to run my test cases. Right now it runs every case but I want to limit it to run specific ones. Datadriver says it has tag functionality but when I add it and try running with “-i sometag” it says that tag does not exist.

Has anyone else run into this issue? Seems like it should be possible im just not sure how to get my robot script to see those tags.

As written in the docs, you have to add the tag to be included to the template test as well:

This can be done by Default Tags or Force Tags In *** Settings *** or with [Tags] at the test case itself.

Also the data in excel need that tag im the [Tags] column.

So right now when i run the test in my report I can see that it sees the tags. If i run the test with include=foo up where I declare my datadriver library it only runs tests with the foo tag which is great but do you know if there is a way to be able to in my command line add -i foo and have it run just the foo tests?
Right now it says that foo isnt a tag. As far as my robot script would be concerned there is just one test case but datadriver runs all 8 of them. At the beginning of my testcase I have [Tags] FLAT.

Sorry if this response doesn’t make much sense have only been using this framework for a week.

If you have [Tags] flat, why do you not add foo to it?

Please post you robot code and your xls.

I think you are missing the point, that for --include you have to add the tags you want to include in the robot file! Not only in the xls file.

So just realized that my [Tags] flat is doing absolutely nothing from what i can tell. I was just looking through the examples from the datadriver github and gave it a shot. Otherwise this is the important bits of my code

Library          DataDriver  Datasheet/W2_Datasheet_End_To_End.xls     sheet_name=W2_Outsourcing
***  Test Cases ***
     Test Case

*** Keywords ***
Test case
      [Arguments]     ${Scenario} 	${json_fileName}	${registeredFiling_Count}    ${expectedStatusArrayRcdCount}   ${SUBDIR}  ${companionFileNamePrefix}
     [Tags] foo

and then my xls file is setup like

${Scenario}  ${json_fileName}  ${registeredFiling_Count}  ${expectedStatusArrayRcdCount}  ${SUBDIR}  ${companionFileNamePrefix}  [Tags]

foo should run 2 tests as 2 of them have that tag and when at the top i have include = foo it works fine but if i run it with --include foo it says nothing has that tag.

sorry for weird formatting on that message hopefully it still makes sense to read.

Yes it does.

Error is on my side!!!
i added that bug with the last release.

i try to fix it today!
Sorry for that.

Glad to hear I wasn’t doing something wrong! Glad I could bring it to attention. Will be keeping a look out for the fix! :slight_smile:

you can try out version 1.3.0

pip install robotframework-datadriver==1.3.0

That should work as well


It is not that easy to fix.
technically yes, but the question is: should the tags of the template be added all to the data-driven tests?

It’s hard to say I guess. In my personal use cases I would want both tags declared in the .robot file and the ones in the excel sheet to work. I think both serve a purpose depending on the use case.

If tags in the excel sheet don’t work then there is no point having them as a feature but also people should have the option of declaring the tags as normal.

That’s my perspective on the question posed in the GitHub link