Search code examples
robotframework

How to exclude dynamic set tags in RobotFramework


Good day for all. I try to exclude dynamic tags but cant reach my goal. What am I doing wrong?

waidw.robot:

# -*- coding=utf-8 -*-
# -*- coding=robot -*-

*** Settings ***
Test Template  My Awesome Keyword
*** Test Cases ***
Case 1  hello  hello  Smoke  Manual
Case 2  world  world  Auto

*** Keywords ***
My Awesome Keyword 
    [Arguments]  ${Alpha}  ${Betta}  @{Tags}
    Set tags  @{Tags}
    Should be equal  ${Alpha}  ${Betta}

from shell:

$ pybot -d ./result --non-critical Auto --exclude Auto wiadw.robot

Solution

  • You cannot include or exclude tests for dynamic tags. When pybot (or equivalent) starts up, it parses all of the code and builds up a list of tests to run before it runs any tests at all. This list of tests doesn't change as tests are run. Plus, in order for a dynamic tag to be set, the test has to start running. It's too late to exclude it at that point.

    In other worlds, --include and --exclude can only work on static tags that are part of the test before the tests run.