Features option helps Cucumber to locate feature files. It Identifies either a URI or a directory containing feature files. It also identifies a specific feature or scenarios and examples (pickles) in a feature.
When no feature path is provided, Cucumber will use the package of the annotated class. For example, if the annotated class is com.examle.Runner then features are assumed to be located in com.example.
Method Signature
- String[] features()
- default {};
- Returns: list of files or directories
Example: @Cucumberoptions Features
@RunWith(Cucumber.class)
@CucumberOptions(
plugin = {"pretty", "html:target/cucumber"},
features = {"src/test/resources/features" },
glue = {"com.pb.cucumbertest.stepdefinitions"},
)
public class Runner {
}
In example given above my features files are inside src/test/resources/features. You can also write like this since our features files are inside src/test/resources
features = "classpath:features"
- Log in to post comments