【问题标题】:cucumber.runtime.CucumberException: No features found at []cucumber.runtime.CucumberException:在 [] 处未找到任何功能
【发布时间】:2017-06-16 11:27:19
【问题描述】:

我是java黄瓜的新手。

当运行 runTest 失败时:

cucumber.runtime.CucumberException: 在 [] 处找不到任何特征

    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>2.47.1</version>
    </dependency>

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

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

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.10</version>
        <scope>test</scope>
    </dependency>

java类:

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

@RunWith(Cucumber.class) 
@Cucumber.Options(format = {"pretty", "html:target/cucumber"}) 

public class runTest { }

功能文件:

Feature: annotation
"#"This is how background can be used to eliminate duplicate steps

背景: 用户导航到 Facebook Given 我在 Facebook 登录页面上

"#"AND 场景 设想: 当我输入用户名作为“TOM” 我输入密码为“JERRY” 那么登录应该会失败

"#"BUT 场景 设想: 当我输入用户名作为“TOM” 我输入密码为“JERRY” 然后登录应该失败 但重新登录选项应该可用

【问题讨论】:

  • 功能文件应该在类路径中
  • 尽我所能清理代码

标签: java maven cucumber


【解决方案1】:

请检查:

如果所有功能文件都存在于

src/test/resources

在Java类中,请同时添加特征路径以读取特征文件。

@Cucumber.Options(format = {"pretty", "html:target/cucumber"},

功能 = {"src/test/resource"}

)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-10-18
    • 2020-07-26
    • 1970-01-01
    • 2021-08-19
    • 1970-01-01
    • 1970-01-01
    • 2010-11-07
    • 1970-01-01
    相关资源
    最近更新 更多