Google News
logo
Cucumber - Interview Questions
How can you use the Options tag in the Cucumber framework?
In the Cucumber framework, the Options tag is a part of the TestRunner file and comes in the form of an annotation called @CucumberOptions. It contains two parameters feature and glue.
 
Feature parameter : The feature parameter is used to specify the path of the feature file.
Glue parameter : The glue parameter is used to specify the path of the step definition file.

See the code implementation of TestRunner file with Option tag :
import org.junit.runner.RunWith;  
import cucumber.api.CucumberOptions;  
import cucumber.api.junit.Cucumber;   
@RunWith (Cucumber.class)  
@CucumberOptions (  
features = "src/test/java/features ",  
glue = {"stepDefinitions"}  
)   
public class TestRunner {  
} ​
 
We have to import org.junit.runner.RunWith for the @RunWith annotation and cucumber.api.CucumberOptions for the @CucumberOptions annotation.
Advertisement