In our JUnit Test Runner class, we us @CucumberOptions annotation. @CucumberOptions are like property file or settings for our test. It provide several option which we use while working with cucumber command line options.
While using IDE like Eclipse, this is very useful and help us to execute our project in several ways. We declare it inside our JUnit Test runner class.
There are several options which you can use as a part of this annotation. Below is the list:
Modifier and Type | Optional Element and Description |
---|---|
boolean | dryRun |
String[] | features |
String[] | format deprecated. use plugin() |
String[] | glue |
String[] | junit |
boolean | monochrome |
String[] | name |
String[] | plugin |
SnippetType | snippets |
boolean | strict |
String[] | tag |
Check below example, using several cucumber options:
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"},
monochrome = true,
tags = {"@contactus"},
dryRun = false,
strict = true
)
public class Runner {
}