serenity-bdd / serenity-cucumber

Cucumber integration for the Serenity BDD Reporting library
Other
78 stars 74 forks source link

starter.CucumberTestSuitejava.lang.NoClassDefFoundError: io/cucumber/java/PendingException #236

Closed push2212 closed 4 years ago

push2212 commented 4 years ago

Hello ,

I am using Cucumber 4 Starter and have created a custom feature file with step defs. I am getting starter.CucumberTestSuitejava.lang.NoClassDefFoundError: io/cucumber/java/PendingException error while running. however if I run only feature file , it runs successfully. PFB stacktrace.

Please help.


[INFO] Scanning for projects... [INFO] [INFO] -------< net.serenitybdd.starter:serenity-cucumber4-smoketests >-------- [INFO] Building Sample Serenity BDD project using Cucumber 1.0.0-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ serenity-cucumber4-smoketests --- [INFO] Deleting C:\Work\serenity-cucumber4-starter\target [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ serenity-cucumber4-smoketests --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Work\serenity-cucumber4-starter\src\main\resources [INFO] [INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ serenity-cucumber4-smoketests --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ serenity-cucumber4-smoketests --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 10 resources [INFO] [INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ serenity-cucumber4-smoketests --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 4 source files to C:\Work\serenity-cucumber4-starter\target\test-classes [INFO] [INFO] --- maven-surefire-plugin:2.22.1:test (default-test) @ serenity-cucumber4-smoketests --- [INFO] Tests are skipped. [INFO] [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ serenity-cucumber4-smoketests --- [WARNING] JAR will be empty - no content was marked for inclusion! [INFO] Building jar: C:\Work\serenity-cucumber4-starter\target\serenity-cucumber4-smoketests-1.0.0-SNAPSHOT.jar [INFO] [INFO] --- maven-failsafe-plugin:2.22.1:integration-test (default) @ serenity-cucumber4-smoketests --- [INFO] [INFO] ------------------------------------------------------- [INFO] T E S T S [INFO] ------------------------------------------------------- starter.CucumberTestSuitejava.lang.NoClassDefFoundError: io/cucumber/java/PendingException at net.thucydides.core.model.failures.FailureAnalysis.(FailureAnalysis.java:74) at net.thucydides.core.steps.BaseStepListener.(BaseStepListener.java:727) at net.thucydides.core.steps.BaseStepListener.(BaseStepListener.java:271) at net.thucydides.core.steps.Listeners$BaseStepListenerBuilder.withOutputDirectory(Listeners.java:37) at net.serenitybdd.core.SerenityListeners.(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.runners.Suite.runChild(Suite.java:128) at org.junit.runners.Suite.runChild(Suite.java:27) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.apache.maven.surefire.junitcore.pc.Scheduler$1.run(Scheduler.java:410) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) 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) ... 24 more [INFO] Running Test Cura Healthcare [INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 s - in Test Cura Healthcare [INFO] [INFO] Results: [INFO] [INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0 [INFO] [INFO] [INFO] --- serenity-maven-plugin:2.1.13:aggregate (serenity-reports) @ serenity-cucumber4-smoketests --- [INFO] Test results for 0 tests generated in 864 ms in directory: file:/C:/Work/serenity-cucumber4-starter/target/site/serenity/ [INFO] ----------------------------------------- [INFO] SERENITY TESTS : SUCCESS [INFO] ----------------------------------------- [INFO] | Tests executed | 0 [INFO] | Tests passed | 0 [INFO] | Tests failed | 0 [INFO] | Tests with errors | 0 [INFO] | Tests compromised | 0 [INFO] | Tests pending | 0 [INFO] | Tests ignored/skipped | 0 [INFO] ------------------------ | -------------- [INFO] | Total Duration | 000ms [INFO] | Fastest test took | 000ms [INFO] | Slowest test took | 000ms [INFO] ----------------------------------------- [INFO] [INFO] SERENITY REPORTS [INFO] - Full Report: file:///C:/Work/serenity-cucumber4-starter/target/site/serenity/index.html [INFO] [INFO] --- maven-failsafe-plugin:2.22.1:verify (default) @ serenity-cucumber4-smoketests --- [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 11.067 s [INFO] Finished at: 2020-06-10T18:26:54+05:30 [INFO] ------------------------------------------------------------------------

wakaleo commented 4 years ago

Use the serenity-cucumber-starter project

push2212 commented 4 years ago

Thanks John , however could you please tell me what is the issue here if I can resolve it with some tweak.

wakaleo commented 4 years ago

There is an incompatibility in the Cucumber APIs. The simplest is to switch entirely to Cucumber 5.

push2212 commented 4 years ago

Alright , switching to Cucumber 5 , thanks Again.