2016-04-04 56 views
0

我正在尝试运行一个如下所述的功能文件。步在黄瓜日食中没有匹配的胶水代码错误

Feature: Prove the concept of my script 

    Scenario: My first Test 
    Given This is my first step 
    When This is my second step 
    Then This is my third step 

,当我使用这项功能的文件,它给写着遵循和步骤已经突出显示的语句中的错误“的步骤没有胶水代码。”

错误如下所示。我想运行上述功能文件并了解该功能的缺失文件。

Exception in thread "main" java.lang.NoClassDefFoundError: gherkin/lexer/Encoding 
    at cucumber.runtime.FeatureBuilder.read(FeatureBuilder.java:154) 
    at cucumber.runtime.FeatureBuilder.parse(FeatureBuilder.java:115) 
    at cucumber.runtime.model.CucumberFeature.loadFromFeaturePath(CucumberFeature.java:104) 
    at cucumber.runtime.model.CucumberFeature.load(CucumberFeature.java:54) 
    at cucumber.runtime.model.CucumberFeature.load(CucumberFeature.java:34) 
    at cucumber.runtime.RuntimeOptions.cucumberFeatures(RuntimeOptions.java:235) 
    at cucumber.runtime.Runtime.run(Runtime.java:110) 
    at cucumber.api.cli.Main.run(Main.java:36) 
    at cucumber.api.cli.Main.main(Main.java:18) 
Caused by: java.lang.ClassNotFoundException: gherkin.lexer.Encoding 
    at java.net.URLClassLoader.findClass(Unknown Source) 
    at java.lang.ClassLoader.loadClass(Unknown Source) 
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) 
    at java.lang.ClassLoader.loadClass(Unknown Source) 
    ... 9 more 

请,我是一个黄瓜首发,我想解决这个问题。如果可以,请你帮助我。

回答

0

这个问题发生的原因是你的eclipse中设置的小黄瓜里面的编码丢失了。 你必须安装最新版本的小黄瓜。 可以从Marven仓库找到最新的小黄瓜。 下载最新版本后,将黄瓜jar文件导入黄瓜项目。

0

请添加与@符号像下面

@featureTest 
Feature: Prove the concept of my script 

@Scenario1 
    Scenario: My first Test 
    Given This is my first step 
    When This is my second step 
    Then This is my third step 

确保在功能文件匹配的话“作为是”步骤定义的Java文件对于给定的,当开始黄瓜代码,然后将