Selenium-Cucument JUnit测试运行程序-未获取注释
我不熟悉Selenium Cumber,尝试使用Eclipse设置基本的Selenium Cumber JVM,但当我以JUnit运行Testrunner时,注释丢失,我需要在步骤定义中手动添加测试步骤。下面是我的特性&junittestrunnerSelenium-Cucument JUnit测试运行程序-未获取注释,selenium,cucumber-junit,cucumber-java,Selenium,Cucumber Junit,Cucumber Java,我不熟悉Selenium Cumber,尝试使用Eclipse设置基本的Selenium Cumber JVM,但当我以JUnit运行Testrunner时,注释丢失,我需要在步骤定义中手动添加测试步骤。下面是我的特性&junittestrunner Feature: Gmail Login @Scenario1 Scenario: User logs into GMail Given Open Browser When Enter gmail link Then Enter login de
Feature: Gmail Login
@Scenario1
Scenario: User logs into GMail
Given Open Browser
When Enter gmail link
Then Enter login details
TestRunner.java
package cucumberTest;
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
@CucumberOptions(features = "C:\\XXXX-PATH\\Feature"
,glue={"stepDefinition"},
tags={"@Scenario1"},
monochrome=true
)
public class TestRunner {
}
当我将TestRunner.java
作为JUnit执行时,代码段缺少注释,因此需要手动编写步骤定义
1个场景(1个未定义)
4个步骤(4个未定义)
您可以使用以下代码段实现缺少的步骤:
Given("^Open Browser$", () -> {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
});
When("^Enter gmail link$", () -> {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
});
有人能帮我吗
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>cucmber_test</groupId>
<artifactId>cucmber_test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<fork>true</fork>
<executable>C:\Program Files\Java\jdk1.8.0_111\bin\javac.exe</executable>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.0.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.47.1</version>
</dependency>
</dependencies>
</project>
4.0.0
库姆伯试验
库姆伯试验
0.0.1-快照
src
maven编译器插件
3.6.1
1.8
1.8
真的
C:\Program Files\Java\jdk1.8.0\u 111\bin\javac.exe
信息杯
黄瓜爪哇
1.2.3
测试
信息杯
黄瓜刺柏
1.2.3
测试
朱尼特
朱尼特
4.12
公用记录
公用记录
1.2
信息杯
黄瓜刺柏
1.0.2
试验
org.seleniumhq.selenium
硒爪哇
2.47.1
这可能是因为您使用的是Java 8 lambda样式的步骤定义。在Java8风格的步骤定义中,不需要@符号。这也不是一个问题。您可以运行脚本,它不会影响执行。请查看链接了解更多详细信息。那么您面临的实际/实际问题/错误/困难是什么功能
文件中的功能描述。感谢您需要在stepDefinition类文件中定义@given和“@when”方法;通过将确切语法复制为SuggestedTanks for response,我没有得到testrunner中建议的确切语法,@given没有创建,只创建了given,因此我需要在StepDefinition中手动添加@syntax。我想我在添加注释的功能文件中缺少了任何版本,@但是在执行testrunner时,我没有得到testrunner中建议的确切语法,@缺少,@未创建给定,仅创建给定,因此我需要在StepDefinition中手动添加@syntax。