Skip to main content

[Cucumber] Run Feature Folder with Tags

Description​

Katalon Studio supports executing feature files in a folder with the runFeatureFolderWithTags function, using the following tag expressions:

Expression Description
@tag1 and @tag2 Features or scenarios tagged with both @tag1 and @tag2.
@tag1 or @tag2 Features or scenarios tagged with either @tag1 or @tag2.

To learn more about tag expressions, refer to this Cucumber document: Cucumber tag expression.

Using the AND tag expression​

Description​

Query the feature files in the specified folder, and execute the features or scenarios associated with all the input tags.

Keyword name: runFeatureFolderWithTags

Keyword syntax: runFeatureFolderWithTags(folderRelativePath, tags, flowControl)

Parameters​

ParameterParameter TypeRequiredDescription
folderRelativePathStringYesThe folder relative path starts from the current project location.
tagsString, String[], or String... (Varargs)YesThe tags of the features or scenarios that you want to execute.
flowControl (only valid when tags are of String[] type)FailureHandlingOptionalControls the execution flow if the step fails. Specify failure handling schema to determine whether the execution should be allowed to continue or stop.

Returns​

An instance of CucumberRunnerResult that includes the status of the keyword and report folder location.

Example​

Example #1: tags of String type

CucumberKW.runFeatureFolderWithTags("Include/features/BDD Cucumber Tests/", "@tag1 and @tag2")

Example #2: tags of String[] type

String[] logTags = ["@tag1", "@tag2"] as String[]
CucumberKW.runFeatureFolderWithTags("Include/features/BDD Cucumber Tests/", logTags, FailureHandling.STOP_ON_FAILURE)

Example #3: tags of String... type (Varargs)

CucumberKW.runFeatureFolderWithTags("Include/features/BDD Cucumber Tests/", "@tag1", "@tag2")

Using the OR tag expression​

Description​

Query the feature files in the specified folder, and execute the features or scenarios associated with any input tags.

Keyword name: runFeatureFolderWithTags

Keyword syntax: runFeatureFolderWithTags(folderRelativePath, tags, flowControl)

Parameters​

ParameterParameter TypeRequiredDescription
folderRelativePathStringYesThe folder relative path starts from the current project location.
tagsString or String[]YesThe tags of the features or scenarios that you want to execute.
flowControl (only valid when tags are of String[] type)FailureHandlingOptionalControls the execution flow if the step fails. Specify failure handling schema to determine whether the execution should be allowed to continue or stop.

Returns​

An instance of CucumberRunnerResult that includes the status of the keyword and report folder location.

Example​

Example #1: tags of String type

CucumberKW.runFeatureFolderWithTags("Include/features/BDD Cucumber Tests/", "@tag1 or @tag2")
// Or 
CucumberKW.runFeatureFolderWithTags("Include/features/BDD Cucumber Tests/", "@tag1, @tag2")

Example #2: tags of String[] type

String[] logTags1 = ["@tag1, @tag2"] as String[]
CucumberKW.runFeatureFolderWithTags("Include/features/BDD Cucumber Tests/", logTags1, FailureHandling.STOP_ON_FAILURE)
// Or 
String[] logTags2 = ["@tag1 or @tag2"] as String[]
CucumberKW.runFeatureFolderWithTags("Include/features/BDD Cucumber Tests/", logTags2, FailureHandling.STOP_ON_FAILURE)
Was this page helpful?