cucumber-java and cucumber-junit after version 1.0.14 does not work

Ripon Al Wasim picture Ripon Al Wasim · Jul 8, 2015 · Viewed 33.9k times · Source

I am using Cucumber-JVM and Selenium WebDriver together. I have a Maven project in eclipse and dependency of pom.xml file is as below:

<dependency>
    <groupId>info.cukes</groupId>
    <artifactId>cucumber-java</artifactId>
    <version>1.2.2</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>info.cukes</groupId>
    <artifactId>cucumber-junit</artifactId>
    <version>1.2.2</version>
    <scope>test</scope>
</dependency>

The content of RunCukesTest.java file is:

import org.junit.runner.RunWith;
import cucumber.junit.Cucumber;
@RunWith(Cucumber.class)
@Cucumber.Options(format = {"pretty", "html:target/cucumber-htmlreport","json-pretty:target/cucumber-report.json"})
public class RunCukesTest {
}

I am getting the error in the following lines of code:

import cucumber.junit.Cucumber;
@RunWith(Cucumber.class)
@Cucumber.Options(format = {"pretty", "html:target/cucumber-htmlreport","json-pretty:target/cucumber-report.json"})

But when I used the version 1.0.14 it works well. What's the wrong with the latest version?

Answer

Vicky picture Vicky · Jul 8, 2015

@Cucumber.Options is deprecated use @CucumberOptions instead

@CucumberOptions(
    format = "pretty",
    features = "//refer to Feature file"  
)

Hope this helps you