简体   繁体   中英

run error in eclipse when trying to run cucumber file

This Error is appears when i trying to run junit test on eclipse using cucumber

ava.lang.NoClassDefFoundError: cucumber/runtime/snippets/SummaryPrinter
    at cucumber.api.junit.Cucumber.run(Cucumber.java:90)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.ClassNotFoundException: cucumber.runtime.snippets.SummaryPrinter
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
... 7 more

I got this error while upgrading the Cucumber version in my Maven based project.

Turn out that I updated <artifactId>cucumber-java</artifactId> version from 1.1.5 to 1.2.4, but I didn't update <artifactId>cucumber-junit</artifactId> - it was still on 1.1.5.

On the moment I updated both to the same version, this error was gone.

Class file that your code depends on and it is present at compile time but not found at runtime. Look for differences in your build time and runtime classpaths.

将cucumber-core,cucumber-java和cucumber-junit更新为相同的版本(我使用的是1.1.5版本)。问题已为我解决。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM