我一直在努力让它发挥作用。
我想设置一个测试运行器类 like so
但是我得到这个错误:
Error:(3, 26) java: package cucumber.api.junit does not exist
Error:(10, 10) java: cannot find symbol
symbol: class Cucumber
类看起来像:
package nl.prvgld.sigma.aanvraagtitels.testutil;
import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;
@RunWith(Cucumber.class)
public class RunFeature {
}
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/maven-v4_0_0.xsd">
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<modelVersion>4.0.0</modelVersion>
<groupId>nl.prvgld.sigma.aanvraagtitels</groupId>
<artifactId>Aanvraagtitels</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>Aanvraagtitels</name>
<url>http://maven.apache.org</url>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-java -->
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java8</artifactId>
<version>1.2.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-core -->
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-core</artifactId>
<version>1.2.5</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-junit -->
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.microsoft.sqlserver/mssql-jdbc -->
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.1.0.jre8</version>
</dependency>
<dependency>
<groupId>com.smartbear.readyapi.testserver.cucumber</groupId>
<artifactId>testserver-cucumber-core</artifactId>
<version>1.0.0</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
所有类都在 Test 文件夹下的某个地方。 我在这里查看了一些相关问题并尝试了解决方案,例如从 Pom 中删除测试,并确保 Pom 中有 junit、cucumber-junit、cucumber-java8 和 cucumber-core。
我正在使用 Intellij。
非常感谢在正确方向上提供的任何帮助!
干杯!
最佳答案
我不知道您是否已经解决了您的问题,但您可以通过从 pom.xml 文件中删除范围标记来快速修复它。对您遇到问题并且应该可以正常工作的所有依赖项执行此操作。
干杯, 呵呵
关于Java: 包 cucumber.api.junit 不存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42924356/