Skip to main content

[Cucumber] Run Feature File

Description

Execute a single Feature File.

Keyword name: runFeatureFile

Keyword syntax: runFeatureFile(relativeFilePath, cucumberRunOptions, flowControl)

Parameters

ParameterParameter TypeRequiredDescription
relativeFilePathStringYesA relative file path of the feature file. To rerun failed scenarios, provide the path to your rerun file prefixed with @ (e.g., @rerun.txt).
cucumberRunOptionsMapNoA map of options to configure the Cucumber execution. Use failedTestFilePath to specify a file path where failed scenarios will be saved.
flowControlFailureHandlingOptionalControls 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

import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW
import com.kms.katalon.core.model.FailureHandling

// Step 1: Run tests and generate rerun file with failed scenarios
CucumberKW.runFeatureFile('Include/features/MyFeature.feature', [failedTestFilePath: 'rerun.txt'], FailureHandling.CONTINUE_ON_FAILURE)
// Step 2: Manually rerun only the failed scenarios (if needed)
CucumberKW.runFeatureFile('@rerun.txt',
[failedTestFilePath: 'rerun2.txt'])
Was this page helpful?