CucumberOptions无法解析为某种类型

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CucumberOptions无法解析为某种类型相关的知识,希望对你有一定的参考价值。

在我的testrunner类中,在使用@CucumberOptions时,我收到一条错误消息“CucumberOptions无法解析为某种类型”。我正在使用最新版本的eclipse黄瓜依赖项。我通过降低黄瓜依赖版本来安装和卸载eclipse,尝试了所有可能的方法。

我的跑步者课程是:

import org.junit.runner.RunWith;
import cucumber.api.junit.*;
import cucumber.api.testng.AbstractTestNGCucumberTests;    

@RunWith(Cucumber.class)
@CucumberOptions(
        // format = {"pretty","html:target/html/" } ,
        features = "src/test/resources", glue = "com.cucumber.bhsibase.party.tests")
public class TestRunner extends AbstractTestNGCucumberTests {
}

还有我的POM.xml:

<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>BHSI_BASE</groupId>
    <artifactId>BHSI_BASE</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>BHSI_BASE</name>
    <url>http://maven.apache.org</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>

        <!-- dependencies added for testng start -->
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.11</version>
            <scope>test</scope>
        </dependency>
        <!-- https://mvnrepository.com/artifact/info.cukes/cucumber-testng -->
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-testng</artifactId>
            <version>1.2.5</version>
        </dependency>
        <!-- dependencies added for testng completed -->

        <!-- dependencies on cucumber jarss -->

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

        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-junit</artifactId>
            <version>1.2.5</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>jdom</groupId>
            <artifactId>jdom</artifactId>
            <version>1.1</version>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-server</artifactId>
            <version>2.53.0</version>
        </dependency>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-core</artifactId>
            <version>1.2.5</version>
        </dependency>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-jvm</artifactId>
            <version>1.2.5</version>
            <type>pom</type>
        </dependency>

        <!-- dependencies on log4j jarss -->
        <!-- https://mvnrepository.com/artifact/log4j/log4j -->
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>

    </dependencies>
</project>

请让我知道如何继续这一点。

答案

我遇到了同样的问题。 cucumber-java 1.2.2正在与我合作。

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

以上是关于CucumberOptions无法解析为某种类型的主要内容,如果未能解决你的问题,请参考以下文章

OnClickListener无法解析为某种类型

在tomcat中手动部署的JSP编译无法解析为某种类型

React Native 导入错误:无法使用 .bin 解析模块(如何导入某种类型的文件?)

编译器无法解析带边界的隐式类型(有时)

CucumberOptions 未在 java8 的 Runner 类中读取

ASP.NET Core 依赖注入错误:尝试激活时无法解析服务类型 - 调用视图组件时出现错误 [重复]