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
Support removing tags set globally by using -tag syntax with [Tags] setting #4374
Currently it is possible to use the Default Tags setting to specify tags that tests have by default but that can be overridden by individual tests by using the [Tags] setting. The whole system to set tags for tests with Force Tags, Default Tags and [Tags] is somewhat complicated and issue #4365 proposes simplifying it so that Force Tags is renamed to Test Tags and Default Tags is removed altogether. I believe simplifying the syntax is a good idea, but I understand there are still sometimes cases where specifying tags that most tests have but some don't would be convenient.
My proposal is that we'd make it possible to use -tag syntax with tests that want to opt out from tags set globally. Basically that would change current
*** Settings ***Force Tags all
Default Tags most
*** Test Cases ***T1
No Operation
T2[Tags] one
No Operation
T3
No Operation
to
*** Settings ***Test Tags all most
*** Test Cases ***T1
No Operation
T2[Tags] one -most
No Operation
T3
No Operation
I actually consider the above easier to understand the original with strange Force Tags and Default Tags settings.
The major benefit of this syntax would be that it would work also with the proposed Keyword Tags setting (#4373). Regardless do we remove Default Tags or not, I don't think it makes sense to add something like Default Keyword Tags in addition to Keyword Tags, but this would work just fine:
*** Settings ***Keywords Tags all most
*** Keywords ***K1
No Operation
K2[Tags] one -most
No Operation
K3
No Operation
Another small problem is handling variables. I believe we should handle the -tag syntax when building the executable model and we don't have variables available at that point. It means we cannot know tag to actually remove if someone uses -${tag} or that does the value actually start with - if the value is just ${tag}. I believe this is how we should handle these issues:
When someone uses -${tag}, remove possible tags that have been set like ${tag}.
If someone uses ${tag} and the value starts with -, just use the value as-is when it is actually resolved. As discussed in the above comment, we'd keep supporting tags starting with - anyway.
Another design decision to make is how to handle possible patterns when using the -tag syntax. For example, should -t* remove literal tag t* or all tags starting with t. The latter would make the feature more powerful, but requires escaping like -t[*] if tags actually contain meta characters used in glob patterns. I believe such meta characters are so rare that making the feature more powerful makes sense.
Activity
pekkaklarck commentedon Jun 20, 2022
A problem with the
-tagsyntax is that someone may be using tags that start with a hyphen. This is how I think we can mitigate that problem:-tagsyntax special with the[Tags]setting. WithTest Tagsjust add all all tags regardless do they start with-or not.\-tag. That would mean adding tag-tag, not removing tagtag.-tagwith[Tags]as a literal tag name in RF 6.0.-tagwith[Tags]to mean removingtagin RF 6.1.pekkaklarck commentedon Jun 20, 2022
Another small problem is handling variables. I believe we should handle the
-tagsyntax when building the executable model and we don't have variables available at that point. It means we cannot know tag to actually remove if someone uses-${tag}or that does the value actually start with-if the value is just${tag}. I believe this is how we should handle these issues:-${tag}, remove possible tags that have been set like${tag}.${tag}and the value starts with-, just use the value as-is when it is actually resolved. As discussed in the above comment, we'd keep supporting tags starting with-anyway.pekkaklarck commentedon Oct 31, 2022
Another design decision to make is how to handle possible patterns when using the
-tagsyntax. For example, should-t*remove literal tagt*or all tags starting witht. The latter would make the feature more powerful, but requires escaping like-t[*]if tags actually contain meta characters used in glob patterns. I believe such meta characters are so rare that making the feature more powerful makes sense.