You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow removing tags using -tag syntax also in Test Tags #5250
Test Tags from *** Settings *** and [Tags] from Test Case behave differently when removing tags: while it is possible to remove tags with Test Case's [Tag] -something, Settings Test Tags -something introduces a new tag -something.
Running tests with these robot files (also attached):
__init__.robot:
*** Settings ***
Test Tags something
-SomethingInSettings.robot:
*** Settings ***
Test Tags -something
*** Test Cases ***
-Something In Settings
Should Be Empty ${TEST TAGS}
-SomethingInTestCase.robot:
*** Test Cases ***
-Something In Test Case
[Tags] -something
Should Be Empty ${TEST TAGS}
The current behavior is actually be design. When the -tag syntax was introduced in RF 7.0 (#4374), it was specifically designed to work only with [Tags]. The main motivation was making the change as little backwards incompatible as possible, by not changing how tags set using Test Tags work. I also believe it didn't occur to us that someone would like to remove tags set in initialization files using this syntax.
Now that I think about this again, I believe the use case to remove tags set in initialization files is pretty important. I also agree that the current behavior that -tag works with [Tags] but not with Test Tags is inconsistent. I think it makes sense to change this, but due to the aforementioned backwards compatibility concerns, the change needs to wait for a major release and we should also deprecate using -tag syntax as a literal tag name in Test Tags first. I thus propose the following:
Let's use this issue for actually making the change. I'll update the title accordingly and assign this to RF 8.0 scope. I'll also submit a separate issue about deprecation and assign it to RF 7.2.
changed the title [-]Inconsistent behavior with `Test Tags` from Settings and `[Tags]` from Test Case[/-][+]Allow removing tags using `-tag` syntax also in `Test Tags`[/+]on Nov 1, 2024
Activity
pekkaklarck commentedon Nov 1, 2024
The current behavior is actually be design. When the
-tagsyntax was introduced in RF 7.0 (#4374), it was specifically designed to work only with[Tags]. The main motivation was making the change as little backwards incompatible as possible, by not changing how tags set usingTest Tagswork. I also believe it didn't occur to us that someone would like to remove tags set in initialization files using this syntax.Now that I think about this again, I believe the use case to remove tags set in initialization files is pretty important. I also agree that the current behavior that
-tagworks with[Tags]but not withTest Tagsis inconsistent. I think it makes sense to change this, but due to the aforementioned backwards compatibility concerns, the change needs to wait for a major release and we should also deprecate using-tagsyntax as a literal tag name inTest Tagsfirst. I thus propose the following:-taginTest Tagsin RF 7.2. We similarly deprecated using-tagwith[Tags]in RF 6.0 (Deprecate setting tags starting with a hyphen like-tagusing the[Tags]setting #4380).Let's use this issue for actually making the change. I'll update the title accordingly and assign this to RF 8.0 scope. I'll also submit a separate issue about deprecation and assign it to RF 7.2.
[-]Inconsistent behavior with `Test Tags` from Settings and `[Tags]` from Test Case[/-][+]Allow removing tags using `-tag` syntax also in `Test Tags`[/+]