Cucumber java - 类型不匹配:无法从Class <cucumber>转换为Class <! - ?在测试运行器中扩展Runner - > error

时间:2016-10-18 14:57:23

标签: javascript selenium-webdriver cucumber

我正在尝试使用java设置黄瓜框架来运行我的测试,但我在测试运行器中遇到类型不匹配错误。

package cucumbertest;

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

@RunWith(Cucumber.class)
@CucumberOptions(
    features = "Feature", 
    glue={"stepDefinition"}
)

public class TestRunner {
}

这是我的代码

1 个答案:

答案 0 :(得分:0)

尝试使用以下配置:

<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>com.learnautomation.cucumber</groupId>
<artifactId>com.learnautomation.cucumber</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>

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

<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.11</version>
</dependency>


<dependency>
    <groupId>info.cukes</groupId>
    <artifactId>cucumber-java</artifactId>
    <version>1.2.2</version>
</dependency>

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