【发布时间】: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” 然后登录应该失败 但重新登录选项应该可用
【问题讨论】:
-
功能文件应该在类路径中
-
尽我所能清理代码