Repository navigation
Open
Milestone
Description
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}
gives the following output:
> robot .
==============================================================================
TagsTest
==============================================================================
TagsTest.-SomethingInSettings
==============================================================================
-Something In Settings | FAIL |
'['-something', 'something']' should be empty.
------------------------------------------------------------------------------
TagsTest.-SomethingInSettings | FAIL |
1 test, 0 passed, 1 failed
==============================================================================
TagsTest.-SomethingInTestCase
==============================================================================
-Something In Test Case | PASS |
------------------------------------------------------------------------------
TagsTest.-SomethingInTestCase | PASS |
1 test, 1 passed, 0 failed
==============================================================================
TagsTest | FAIL |
2 tests, 1 passed, 1 failed
==============================================================================
(https://forum.robotframework.org/t/removing-tags-from-the-test-tags-setting/7513/6?u=romanliv confirms this as an issue to be fixed)
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`[/+]