簡體   English   中英

運行Junit時出錯-java.lang.NoClassDefFoundError:gherkin / IGherkinDialectProvider

[英]Error while running Junit - java.lang.NoClassDefFoundError: gherkin/IGherkinDialectProvider

我正在嘗試使用硒WD與黃瓜和Junit創建一個框架。 我已經設置/下載了所有文件,但在運行時遇到了問題。

當我嘗試執行JUNIT類時出現以下錯誤。 有沒有人遇到過同樣的問題,請問您如何解決?

使用的Jar文件版本:

•Cucumber-core 4.4.0•Cucumber-html 4.4.0•cobertura代碼覆蓋率2.1.1•Cucumber-java 4.4.0•Cucumber-junit 4.4.0•Cucumber-jvm-deps 1.0.6•Gherkin 6.0.17•朱尼特4.12

錯誤跟蹤:java.lang.NoClassDefFoundError:gherkin / IGherkinDialectProvider

這意味着您使用了錯誤的罐子組合。 (Afaik Cucumber-jvm v4不使用Gherkin6。)

請注意,Cucumber建議使用程序包管理器(Maven或Gradle)來防止此問題,並確保獲得正確的傳遞依賴項。

查看Cucumber文檔中的安裝說明,以查看所需的依賴項。

對於Maven:

If you are going to use the lambda expressions API (Java 8) to write the step definitions, 
add the following dependency to your pom.xml:

<dependency>
    <groupId>io.cucumber</groupId>
    <artifactId>cucumber-java8</artifactId>
    <version>4.3.1</version>
    <scope>test</scope>
</dependency>

Otherwise, to write them using annotated methods, 
add the following dependency to your pom.xml:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM