创建步骤定义选项在黄瓜的 IDEA 中不可见
Create step definition option is not visible in IDEA for cucumber
我已经为简单的测试用例定义了一个 Gherkin 步骤,如下所示。但是当我将鼠标悬停在一个步骤上时,我看不到 "Create step definitions" 的选项。
功能:这是一个测试功能
场景:访问网页
给定:用户在 google
并且:用户键入搜索词作为测试
然后:页面应该加载
Pom 文件:-
<?xml version="1.0" encoding="UTF-8"?>
http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
<groupId>cucumberPOC</groupId>
<artifactId>cucumberTests</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.3.1</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-core</artifactId>
<version>1.2.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/info.cukes/gherkin -->
<dependency>
<groupId>info.cukes</groupId>
<artifactId>gherkin</artifactId>
<version>2.12.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-java -->
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java8</artifactId>
<version>1.2.5</version>
<scope>test</scope>
</dependency>
</dependencies>
你能用一个更小的例子让它工作吗?您的项目设置可能有问题。
我会克隆 Cucumber 团队提供的入门项目:https://github.com/cucumber/cucumber-java-skeleton
使用 Maven 构建它以确保它能正常工作。使用 IntelliJ IDEA 打开它,看看您看到的错误是否仍然存在。我希望它会消失。
通过一个工作示例,逐步将其扩展到您真正想做的事情。扩展有效的东西比修复损坏的东西要容易得多。
我在 Intellij IDEA 中安装 'Cucumber plugin for java' 后问题得到解决。
我已经为简单的测试用例定义了一个 Gherkin 步骤,如下所示。但是当我将鼠标悬停在一个步骤上时,我看不到 "Create step definitions" 的选项。
功能:这是一个测试功能 场景:访问网页 给定:用户在 google 并且:用户键入搜索词作为测试 然后:页面应该加载
Pom 文件:-
<?xml version="1.0" encoding="UTF-8"?>
http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0
<groupId>cucumberPOC</groupId>
<artifactId>cucumberTests</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.3.1</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-core</artifactId>
<version>1.2.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/info.cukes/gherkin -->
<dependency>
<groupId>info.cukes</groupId>
<artifactId>gherkin</artifactId>
<version>2.12.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-java -->
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java8</artifactId>
<version>1.2.5</version>
<scope>test</scope>
</dependency>
</dependencies>
你能用一个更小的例子让它工作吗?您的项目设置可能有问题。
我会克隆 Cucumber 团队提供的入门项目:https://github.com/cucumber/cucumber-java-skeleton
使用 Maven 构建它以确保它能正常工作。使用 IntelliJ IDEA 打开它,看看您看到的错误是否仍然存在。我希望它会消失。
通过一个工作示例,逐步将其扩展到您真正想做的事情。扩展有效的东西比修复损坏的东西要容易得多。
我在 Intellij IDEA 中安装 'Cucumber plugin for java' 后问题得到解决。