黄瓜Java-在文件<location>中找不到功能

时间:2020-04-21 11:29:41

标签: maven selenium cucumber

运行maven命令“ mvn clean verify”时出现以下错误。我将“功能”文件放在“ C:/ Users / 304090 / eclipse-workspace / evms-qa-testautomation / src / test / resources /”中。但是,它无法识别该文件。请提出建议。

Apr 21, 2020 7:19:43 PM io.cucumber.core.runtime.FeaturePathFeatureSupplier get
WARNING: No features found at file:/C:/Users/304090/eclipse-workspace/evms-qa-testautomation/src/test/resources/


0 Scenarios
0 Steps
0m
0.000s

文件夹结构:

enter image description here

1 个答案:

答案 0 :(得分:1)

检查您的测试运行程序类,其中提供了功能特征文件的路径。当前,该类正在寻找.feature文件的C:/Users/304090/eclipse-workspace/evms-qa-testautomation/src/test/resources/文件夹。

cucumber.api.CucumberOptions导入@CucumberOptions批注,它将告诉您在哪里查找功能文件

您需要在src/test/resources中创建功能文件夹,然后将.feature file放在其中。之后,只需更新您的跑步者课程

import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;

@RunWith(Cucumber.class)
@CucumberOptions(
     features = "src/test/resources/features/featurefileanme.feature",
     glue={"path of glue package"}
 )

public class TestRunner {
 }

宁静:

import cucumber.api.CucumberOptions;
import net.serenitybdd.cucumber.CucumberWithSerenity;
import org.junit.runner.RunWith;

@RunWith(CucumberWithSerenity.class)
@CucumberOptions(
        features = "src/test/resources/CreatePreVioltReport.feature",
        glue = "stepsDef"
)

public class RunTests {}