How to resolve deprecated @CucumberOptions?
Asked Answered
F

3

5

In the following code i was using @cucumber.options.But it says it is deprecated.

So i am trying to use @cucumberoptions which requires an import of "cucumber.api.CucumberOptions". But when i checked in my maven dependencies , cucumber.api does not contain cucumberoptions. And i am getting a red line for my import "import cucumber.api.CucumberOptions;"

My aim is to create a good report and set its path .

I could find a related question - How to resolve the deprecation of format option in @CucumberOptions? here but could not find an answer i am looking for. I would really appreciate if any of you could find a resolution to this .

My Code is as follows:-

package featurefiles;
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.*;
@RunWith(Cucumber.class)
@CucumberOptions(strict = false, features = "features", format = { "pretty",
    "html:target/site/cucumber-pretty",
    "json:target/cucumber.json" }, tags = { "~@ignore" })
public class CucumberTestRunner {
}
Freidafreight answered 3/12, 2015 at 10:41 Comment(0)
W
12

Instead of :

import cucumber.api.CucumberOptions;

Use:

import io.cucumber.junit.CucumberOptions;
Wentz answered 22/8, 2019 at 16:10 Comment(0)
M
3

Instead of the legacy classes import them from io package:

import cucumber.api.CucumberOptions; >> import io.cucumber.junit.CucumberOptions; and import cucumber.api.junit.Cucumber >> import io.cucumber.junit.Cucumber;

Mazzola answered 17/2, 2020 at 11:5 Comment(0)
F
2

I found answer to this .

{import cucumber.api.CucumberOptions;}

was not needed .

Thanks.

Freidafreight answered 3/12, 2015 at 13:40 Comment(1)
SO do you mean @CucumberOptions is not required?Burletta

© 2022 - 2024 — McMap. All rights reserved.