# Tag Includes doesn't seem to work, Tag exclude does

**URL:** <https://forum.robotframework.org/t/tag-includes-doesnt-seem-to-work-tag-exclude-does/4581>\
**Category:** DataDriver\
**Created:** [25 August 2022 09:52 UTC](https://forum.robotframework.org/t/tag-includes-doesnt-seem-to-work-tag-exclude-does/4581 "2022-08-25T09:52:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![zac-hamid-arm](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/zac-hamid-arm/32/1835_2.png) [@zac-hamid-arm](https://forum.robotframework.org/u/zac-hamid-arm)\
**Post date:** [25 August 2022 09:52 UTC](https://forum.robotframework.org/t/tag-includes-doesnt-seem-to-work-tag-exclude-does/4581/1 "2022-08-25T09:52:45Z")

</div>

**Context**  
I’m using a custom Data Reader to port our sparse test data to the Data driver JSON format. Through that I am setting the tags dynamically. I am attempting to selectively run the tests via the include and exclude tags:

- Using `-e <tags to exclude>` seems to work as expected, and only runs those which do not have those tags on those tests (excluding those that do have any of those tags set)
- Using `-i <tag to include>` gives back the error `[ERROR] Suite <name> contains no tests matching tag <tag to include>`

At the moment I am getting around this using multiple exclude parameters rather than a single include

**Other information**  
robotframework–4.0.3  
robotframework-datadriver==1.4.1

---

<div class="post-metadata">

**Author:** ![René](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/ren%C3%A9/32/7_2.png) [@René](https://forum.robotframework.org/u/Ren%C3%A9)\
**Post date:** [25 August 2022 15:03 UTC](https://forum.robotframework.org/t/tag-includes-doesnt-seem-to-work-tag-exclude-does/4581/2 "2022-08-25T15:03:49Z")

</div>

Hi,

as written in [docs](https://github.com/Snooz82/robotframework-datadriver#robot-framework-command-line-arguments) you need to add a tag to the template test and include that.

I would recommend to just add a tag “`datadriver`” to all DataDriver Suites and then call always:

`robot --include datadriver --include <yourDynInclTags> --exclude <yourDynExclTags> `

If you do not include the static template test case of the robot file, robot will remove that from execution and the suite with DataDriver will never be executed.

---

<div class="post-metadata">

**Author:** ![zac-hamid-arm](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/zac-hamid-arm/32/1835_2.png) [@zac-hamid-arm](https://forum.robotframework.org/u/zac-hamid-arm)\
**Post date:** [25 August 2022 15:41 UTC](https://forum.robotframework.org/t/tag-includes-doesnt-seem-to-work-tag-exclude-does/4581/3 "2022-08-25T15:41:31Z")

</div>

Thanks for the swift response Rene.

So with this method, if we were to use 2 `--include`s like you’ve exampled above, it would continue to run the entire suite since every test will have the same tag `datadriver`.

It seems this is an established limitation - thank you for confirming, it looks like we will have to make use of the `--exclude` argument instead
