Udemy REST Assured free

Cucumber Options: Glue and Feature

Inside Cucumber Runner annotation we specify different options, two of them are features and glue.

package com.pb.cucumbertest.stepdefinitions;

import org.junit.runner.RunWith;

import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;

@RunWith(Cucumber.class)
@CucumberOptions(
		plugin = {"pretty", "html:target/cucumber"},
		features = {"features"},
		glue={"com.pb.cucumbertest.stepdefinitions"},
		)

public class Runner {

}

Let's discuss about each of them in more detail.

features: Identifies either a directory containing feature files, a specific feature or specific 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.

public abstract String[] features

Returns: the paths to the feature(s)

Default: {}

glue: Package to load glue code (step definitions, hooks and plugins) from. When no glue is provided, Cucumber will use the package of the annotated class. For example, if the annotated class is com.example.Runner then glue is assumed to be located in com.example.

public abstract String[] glue

Returns: where to look for glue code (stepdefs and hooks)

Default: {}

Video Tutorial: @CucumberOptions Features and Glue Options