英文:
I have this error with cucumber when running the runner"java.lang.NoClassDefFoundError: io/cucumber/messages/Messages$JavaMethod"
问题
FAILED: runScenario("Register To website", "Optional[User Registration]")
Runs Cucumber Scenarios
java.lang.NoClassDefFoundError: io/cucumber/messages/Messages$JavaMethod
at io.cucumber.core.runner.CachingGlue.createSourceReference(CachingGlue.java:303)
at io.cucumber.core.runner.CachingGlue.lambda$emitStepDefined$5(CachingGlue.java:293)
at java.util.Optional.ifPresent(Unknown Source)
at io.cucumber.core.runner.CachingGlue.emitStepDefined(CachingGlue.java:293)
at io.cucumber.core.runner.CachingGlue.lambda$prepareGlue$3(CachingGlue.java:252)
at java.util.ArrayList.forEach(Unknown Source)
at io.cucumber.core.runner.CachingGlue.prepareGlue(CachingGlue.java:243)
at io.cucumber.core.runner.Runner.runPickle(Runner.java:68)
I have this error when running cucumber with BDD and java
UPdate:
i use this dependancies for Cucumber what is wrong with it
英文:
FAILED: runScenario("Register To website", "Optional[User Registration]")
Runs Cucumber Scenarios
java.lang.NoClassDefFoundError: io/cucumber/messages/Messages$JavaMethod
at io.cucumber.core.runner.CachingGlue.createSourceReference(CachingGlue.java:303)
at io.cucumber.core.runner.CachingGlue.lambda$emitStepDefined$5(CachingGlue.java:293)
at java.util.Optional.ifPresent(Unknown Source)
at io.cucumber.core.runner.CachingGlue.emitStepDefined(CachingGlue.java:293)
at io.cucumber.core.runner.CachingGlue.lambda$prepareGlue$3(CachingGlue.java:252)
at java.util.ArrayList.forEach(Unknown Source)
at io.cucumber.core.runner.CachingGlue.prepareGlue(CachingGlue.java:243)
at io.cucumber.core.runner.Runner.runPickle(Runner.java:68)
I have this error when running cucumber with BDD and java
1: https://i.stack.imgur.com/8VgxW.png
[2]: https://i.stack.imgur.com/h8SSv.png
[3]: https://i.stack.imgur.com/R5WqZ.png
UPdate :
i use this dependancies for Cucumber what is wrong with it
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-testng</artifactId>
<version>6.4.0</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-core</artifactId>
<version>6.4.0</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>6.4.0</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>gherkin</artifactId>
<version>15.0.0</version>
</dependency>
答案1
得分: 0
我降级了依赖项,然后它起作用了,因为我使用了 java 8。
我的参考资料是Cucumber docs。
<dependency>
<groupId>com.github.javafaker</groupId>
<artifactId>javafaker</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-testng</artifactId>
<version>6.2.0</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-core</artifactId>
<version>6.2.0</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>6.2.0</version>
</dependency>
英文:
I downgraded the dependencies then it worked because I use java 8
My reference is Cucumber docs
<dependency>
<groupId>com.github.javafaker</groupId>
<artifactId>javafaker</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-testng</artifactId>
<version>6.2.0</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-core</artifactId>
<version>6.2.0</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>6.2.0</version>
</dependency>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论