【问题标题】:Cucumber Java - No features found at file <location>Cucumber Java - 在文件 <location> 中找不到任何功能
【发布时间】:2020-04-21 11:29:41
【问题描述】:

运行 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

文件夹结构:

【问题讨论】:

    标签: maven selenium cucumber


    【解决方案1】:

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

    cucumber.api.CucumberOptions 导入 @CucumberOptions 注释,它会告诉在哪里寻找功能文件

    您需要在 src/test/resources 中创建 features 文件夹,并在其中添加您的 .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 {}
    

    【讨论】:

    • 谢谢迪帕克。我的 TestRunner 如下所示。我正在从 io.cucumber.junit.CucumberOptions 导入@CucumberOptions。 ' 包 com.cog.ltaevms.testrunner;导入 org.junit.runner.RunWith;导入 io.cucumber.junit.CucumberOptions;导入 net.serenitybdd.cucumber.CucumberWithSerenity; @RunWith(CucumberWithSerenity.class) @CucumberOptions( plugin = {"pretty"}, features = "src/test/resources/CreatePreVioltReport.Feature",glue = "/src/test/java/com/cog/ltaevms/testrunner" ) 公共类 TestRunner { } '
    • 检查更新的解决方案不确定为什么你的胶水代码指的是 src/test/java/com/cog/ltaevms/testrunner
    猜你喜欢
    • 2013-12-26
    • 1970-01-01
    • 1970-01-01
    • 2019-10-16
    • 1970-01-01
    • 2018-11-07
    • 1970-01-01
    • 2016-02-26
    • 1970-01-01
    相关资源
    最近更新 更多