CucumberOptions未在java8的Runner类中读取

CucumberOptions未在java8的Runner类中读取,cucumber,Cucumber,请回答这个问题 import org.junit.runner.RunWith; //import io.cucumber.junit.CucumberOptions; import cucumber.api.CucumberOptions; import io.cucumber.junit.Cucumber; @RunWith(Cucumber.class) @CucumberOptions( features={"./src/test/java/featureFiles/featur

请回答这个问题

import org.junit.runner.RunWith;
//import io.cucumber.junit.CucumberOptions;
import cucumber.api.CucumberOptions;
import io.cucumber.junit.Cucumber;
@RunWith(Cucumber.class)
@CucumberOptions(
    features={"./src/test/java/featureFiles/feature.feature"}
    ,glue = {"stepDefs"}
    //,monochrome = true
    //,tags={"@tag1"}
//  ,dryRun=true
    //,strict = false
    //plugin = {"pretty", "html:test-output"}
    )

public class Test{
}
此处“features”关键字不是读取特征文件的路径。而“glue”关键字不是步骤定义的读取路径。因为,当我以-->Junit测试运行时。我越来越

  Apr 06, 2020 7:19:34 PM io.cucumber.junit.Cucumber <init>
WARNING: By default Cucumber is running in --non-strict mode.
This default will change to --strict and --non-strict will be removed.
You can use --strict or @CucumberOptions(strict = true) to suppress this warning
Apr 06, 2020 7:19:34 PM io.cucumber.core.runtime.FeaturePathFeatureSupplier get
WARNING: No features found at classpath:/com/packagePath
2020年4月06日晚上7:19:34 io.cumber.junit.cumber
警告:默认情况下Cucumber以--non-strict模式运行。
此默认值将更改为--strict,而--non strict将被删除。
您可以使用--strict或@CucumberOptions(strict=true)来抑制此警告
2020年4月6日晚上7:19:34 io.cucumber.core.runtime.FeaturePathFeatureSupplier获取
警告:在classpath:/com/packagePath中未找到任何功能
0场景 0步 0m0.000s

当我单击任何功能文件步骤时,我可以转到步骤定义实现的路径,但当我从Runner类运行时,我看到上面的消息。即使我将我的功能文件保存在Runner类和run的同一个包中,我也会得到添加缺少的代码片段的代码。当我在StepDefinition文件中添加缺少的代码片段并将其保存在同一个包或其他包中时,我无法看到结果

我尝试了我所知道的所有方面。但我无法找出问题所在。

第3行:

import cucumber.api.CucumberOptions;
拆下此部件并将其更换为

import io.cucumber.junit.CucumberOptions;

将此用于功能选项-{“src/test/java/featureFiles/feature.feature”}。将粘合代码放在runner包的同一个包或子包中,这样就不需要提及显式粘合选项。