serenity-bdd / serenity-cucumber4-starter

48 stars 73 forks source link

Class Configuration issue on 2.1.13 above. #31

Closed basnetyub closed 4 years ago

basnetyub commented 4 years ago

I pulled your code and tried to run it on mvn But I get the error

java.lang.NoClassDefFoundError: io/cucumber/java/PendingException

    at net.thucydides.core.model.failures.FailureAnalysis.<clinit>(FailureAnalysis.java:74)
    at net.thucydides.core.steps.BaseStepListener.<init>(BaseStepListener.java:727)
    at net.thucydides.core.steps.BaseStepListener.<init>(BaseStepListener.java:271)
    at net.thucydides.core.steps.Listeners$BaseStepListenerBuilder.withOutputDirectory(Listeners.java:37)
    at net.serenitybdd.core.SerenityListeners.<init>(SerenityListeners.java:30)
    at cucumber.runtime.formatter.SerenityReporter.initialiseListenersFor(SerenityReporter.java:112)
    at cucumber.runtime.formatter.SerenityReporter.lambda$handleTestSourceRead$0(SerenityReporter.java:149)
    at java.util.Optional.ifPresent(Optional.java:159)
    at cucumber.runtime.formatter.SerenityReporter.handleTestSourceRead(SerenityReporter.java:144)
    at cucumber.runner.AbstractEventPublisher.send(AbstractEventPublisher.java:45)
    at cucumber.runner.AbstractEventBus.send(AbstractEventBus.java:9)
    at cucumber.runner.TimeServiceEventBus.send(TimeServiceEventBus.java:3)
    at cucumber.runtime.model.CucumberFeature.sendTestSourceRead(CucumberFeature.java:44)
    at io.cucumber.junit.CucumberSerenityRunner$RunCucumber.evaluate(CucumberSerenityRunner.java:234)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
    at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
    at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
    at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
Caused by: java.lang.ClassNotFoundException: io.cucumber.java.PendingException
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
    ... 20 more

But if I change the dependency from

2.1.13 to 2.0.91

It works.

After checking the class of serenity-model-2.1.13.jar!\net\thucydides\core\model\failures\FailureAnalysis.class

The new version import io.cucumber.java.PendingException; for

    DEFAULT_PENDING_TYPES.addAll(Arrays.asList(PendingStepException.class, PendingException.class));

But there is no such class/package io.cucumber.java.PendingException

Old version 2.0.91 use import cucumber.api.PendingException; which exists How do we fix it?

wakaleo commented 4 years ago

Use the serenity-cucumber-starter project as a template and switch to serenity-core and serenity-cucumber 2.2.0.

basnetyub commented 4 years ago

Yes, updated to cucumber 5 + 2.2.0 did the trick

2.2.0 2.2.0 2.2.0 5.5.0
oguzkaganeren commented 4 years ago

I also get the same error. Fixed with `

UTF-8 2.0.91 2.0.91 2.1.2 4.8.0 UTF-8 4 `
Qarj commented 4 years ago

Thanks @oguzkaganeren, your change got me past that error, now it seems I need to update the ChromeDriver version also :)