Shi Tim
Shi Tim

Reputation: 453

Cucumber runner class initialised with error after upgrade from cucumber 4.2.3 to 5.1.3

I recently upgrade my test automation project from cucumber 4.2.3 to 5.1.3. When 4.2.3 the tests were running OK(running in parallel). However, once I upgraded to 5.1.3. The runner class initialised with an error.

[ERROR] initializationError(com.my.project.CukeTest)  Time elapsed: 0.008 s  <<< ERROR!
java.lang.NoClassDefFoundError: cucumber/api/event/ConcurrentEventListener
Caused by: java.lang.ClassNotFoundException: cucumber.api.event.ConcurrentEventListene

Below is my runner class.

import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
import org.junit.runner.RunWith;

@RunWith(Cucumber.class)
@CucumberOptions(
    features = {"src/test/resources/features"},
    plugin = {
      "pretty",
      "html:target/cucumber-html-report",
      "json:target/cucumber/cucumber.json",
      "junit:target/cucumber/cucumber.xml",
      "io.qameta.allure.cucumber4jvm.AllureCucumber4Jvm",
      "rerun:target/rerun.txt"
    },
    glue = {"com.my.project.steps", "com.my.project.hook"},
    monochrome = true
    )
public class CukeTest {} 

As you can see there is no direct call on ConcurrentEventListener in the Runner class. I know that since 4.7.x or 4.8.x there are a lot of import have been changed. I've updated those imports already.

Any inputs will be welcome. Thank you in advance.

dependencies that I used.

<cucumber.version>5.1.3</cucumber.version>

        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-junit</artifactId>
            <version>${cucumber.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-core</artifactId>
            <version>${cucumber.version}</version>
        </dependency>

        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-java8</artifactId>
            <version>${cucumber.version}</version>
        </dependency>

        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-spring</artifactId>
            <version>${cucumber.version}</version>
        </dependency>

Upvotes: 1

Views: 1269

Answers (1)

M.P. Korstanje
M.P. Korstanje

Reputation: 12039

You're using the io.qameta.allure.cucumber4jvm.AllureCucumber4Jvm plugin. This plugin isn't compatible with v5.

Upvotes: 1

Related Questions