Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/322.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Can';jvm中的t执行特性_Java_Cucumber_Language Features_Gherkin - Fatal编程技术网

Java Can';jvm中的t执行特性

Java Can';jvm中的t执行特性,java,cucumber,language-features,gherkin,Java,Cucumber,Language Features,Gherkin,我对黄瓜很陌生(从今天开始) 这看起来很简单,但我在运行基本功能时遇到了问题 Feature: Proof of concept that my framework works Scenario: My first test Given this is my first step When this is my second step Then this is my final step 我知道没有代码可供测试,但我希望它返回场景未定义的事实 我做了一些研究,意识到我有一个不必要的.jar

我对黄瓜很陌生(从今天开始)

这看起来很简单,但我在运行基本功能时遇到了问题

Feature: Proof of concept that my framework works

Scenario: My first test

Given this is my first step
When this is my second step
Then this is my final step
我知道没有代码可供测试,但我希望它返回场景未定义的事实

我做了一些研究,意识到我有一个不必要的.jar文件,我已经删除了它

我仍然有以下问题:

Exception in thread "main" java.lang.NoClassDefFoundError: gherkin/lexer/Encoding

Caused by: java.lang.ClassNotFoundException: gherkin.lexer.Encoding
有一些来自异常的更多信息

我还需要提供其他信息吗


如果您有任何帮助,我们将不胜感激。

请确保您的类路径中有cucumber java库。

这是一个设置问题,因为它找不到解释gherkin语句所需的cucumber类。
提供有关安装中包含的文件的更多信息。

我在运行本书的第一步章节时遇到了同样的问题

它说下载最新版本的小黄瓜罐(除其他外)从

下面是清单,在网页上,每个都是一个包含jar的目录链接。我的错误是认为最底层的版本是最新的版本。不是。对于所有其他jar,最底层实际上是最新的版本

使用最底部的小黄瓜罐时,我得到的CNFX与您描述的完全相同:

Exception in thread "main" java.lang.NoClassDefFoundError: gherkin/lexer/Encoding
Caused by: java.lang.ClassNotFoundException: gherkin.lexer.Encoding
版本号列表,如上述网页所示:

2.10.0/
2.11.0/
2.11.1/
2.11.2/
2.11.4/
2.11.5/
2.11.6/
2.11.7/
2.11.8/
2.12.0/
2.12.1/
2.12.2/
2.4.16/
2.4.17/
2.4.18/
2.4.19/
2.4.20/
2.4.21/
2.5.0/
2.5.1/
2.5.2/
2.5.3/
2.5.4/
2.6.0/
2.6.1/
2.6.2/
2.6.3/
2.6.4/
2.6.5/
2.6.6/
2.6.7/
2.6.8/
2.6.9/
2.7.0/
2.7.1/
2.7.2/
2.7.3/
2.7.4/
2.7.5/
2.7.6/
2.7.7/
2.8.0/
2.9.0/
2.9.1/
2.9.2/
2.9.3/

使用包管理器下载依赖项,而不是下载单个JAR

使用Maven,将以下依赖项添加到pom.xml中:

<dependency>
    <groupId>io.cucumber</groupId>
    <artifactId>cucumber-java</artifactId>
    <version>2.3.1</version>
    <scope>test</scope>
</dependency>

<dependency>
    <groupId>io.cucumber</groupId>
    <artifactId>cucumber-junit</artifactId>
    <version>2.3.1</version>
    <scope>test</scope>
</dependency>

黄瓜
黄瓜爪哇
2.3.1
测试
黄瓜
黄瓜刺柏
2.3.1
测试
注意。这是目前的最新版本

确保对所有Cucumber依赖项使用相同的版本