在我的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>
请告诉我如何继续这样做。
答案 0 :(得分:2)
我遇到了同样的问题。 cucumber-java 1.2.2正在为我工作。
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.2</version>
</dependency>
答案 1 :(得分:0)
要解决此导入问题,请执行以下操作-导入cumul.api.CucumberOptions;
添加以下Maven依赖项-
信息提示 黄瓜芯 1.2.5
答案 2 :(得分:-1)
此选项效果很好。
答案 3 :(得分:-2)
我遇到了同样的问题,并通过添加以下maven依赖项解决了该错误:
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.2</version>
</dependency>
谢谢。