Package io.karatelabs.core
Class TagSelector
java.lang.Object
io.karatelabs.core.TagSelector
Advanced tag selector supporting V1-compatible expressions.
Supports:
- anyOf('@foo', '@bar') - match if any tag present
- allOf('@foo', '@bar') - match if all tags present
- not('@tag') - exclude tag
- valuesFor('@tag').isPresent - check if tag has values
- valuesFor('@tag').isAnyOf(1, 2) - check if any value matches
- valuesFor('@tag').isAllOf(1, 2) - check if all values present
- valuesFor('@tag').isOnly(1, 2) - exact value match
- valuesFor('@tag').isEach(fn) - predicate on values
- Compound expressions: anyOf('@foo') invalid input: '&'invalid input: '&' !anyOf('@ignore')
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classValues helper class for valuesFor('@tag') functionality. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanbooleanbooleanEvaluate a tag selector expression against this set of tags.static StringfromKarateOptionsTags(String... tags) Convert Karate/Cucumber-style tag expressions to JS-style tag selector.static StringfromKarateOptionsTags(List<String> tags) Convert Karate/Cucumber-style tag expressions to JS-style tag selector.booleantoString()
-
Constructor Details
-
TagSelector
-
-
Method Details
-
evaluate
Evaluate a tag selector expression against this set of tags.- Parameters:
tagSelector- the selector expression (e.g., "anyOf('@foo') invalid input: '&'invalid input: '&' not('@ignore')")karateEnv- the current karate.env value (may be null)- Returns:
- true if the tags match the selector
-
anyOf
-
allOf
-
not
-
valuesFor
-
contains
-
getTagTexts
-
getTagValues
-
fromKarateOptionsTags
Convert Karate/Cucumber-style tag expressions to JS-style tag selector.Examples:
- "@foo" → "anyOf('@foo')"
- "@foo, @bar" → "anyOf('@foo','@bar')"
- "@foo", "@bar" (multiple args) → "anyOf('@foo') invalid input: '&'invalid input: '&' anyOf('@bar')"
- "~@ignore" → "not('@ignore')"
- "anyOf('@foo')" (already JS-style) → "anyOf('@foo')"
- Parameters:
tags- the tag expressions- Returns:
- the JS-style tag selector, or null if no tags
-
fromKarateOptionsTags
Convert Karate/Cucumber-style tag expressions to JS-style tag selector.- Parameters:
tags- the tag expressions- Returns:
- the JS-style tag selector, or null if no tags
-
toString
-