java.lang.NoClassDefFoundError:gherkin / formatter / Reporter for Cucumber with extent reports

时间:2018-03-11 11:30:08

标签: java selenium junit cucumber extent

我正在尝试使用JUnit使用Cucumber和Extent报告为我的测试用例生成范围报告。但我得到了:

align-itemsalign-content

这些是我添加到我的pom.xml中的依赖项:

java.lang.NoClassDefFoundError: gherkin/formatter/Reporter

这是我得到的例外。

java.lang.NoClassDefFoundError exception while running cucumber test using JUnit

我的跑步者课程如下:

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

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-testng</artifactId>
        <version>2.3.1</version>
    </dependency>

    <dependency>
        <groupId>com.beust</groupId>
        <artifactId>jcommander</artifactId>
        <version>1.27</version>
    </dependency>

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

    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.13</version>
        <scope>test</scope>
    </dependency>

    <dependency> 
        <groupId>org.seleniumhq.selenium</groupId> 
        <artifactId>selenium-java</artifactId> 
        <version>3.8.1</version> 
    </dependency> 

    <dependency>
        <groupId>com.vimalselvam</groupId>
        <artifactId>cucumber-extentsreport</artifactId>
        <version>3.0.0</version>
    </dependency>

    <dependency>
        <groupId>com.aventstack</groupId>
        <artifactId>extentreports</artifactId>
        <version>3.1.3</version>
    </dependency>

    <dependency>
        <groupId>com.relevantcodes</groupId>
        <artifactId>extentreports</artifactId>
        <version>2.41.2</version>
    </dependency>

    <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-jvm-deps</artifactId>
        <version>1.0.3</version>
        <scope>provided</scope>
    </dependency>

我无法弄清楚出了什么问题。

任何修复此问题的建议都会有所帮助。

1 个答案:

答案 0 :(得分:0)

不确定这一点,但将其添加到您的依赖项列表可能有所帮助。

<dependency>
    <groupId>info.cukes</groupId>
    <artifactId>gherkin</artifactId>
    <version>2.7.3</version>
</dependency>