Java 无法运行测试
我一直在试着做一个简单的黄瓜测试。 但它给了我以下错误:Java 无法运行测试,java,cucumber,Java,Cucumber,我一直在试着做一个简单的黄瓜测试。 但它给了我以下错误: Exception in thread "main" java.lang.NoClassDefFoundError: cucumber/io/ResourceLoader at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
Exception in thread "main" java.lang.NoClassDefFoundError: cucumber/io/ResourceLoader
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.getConstructor(Unknown Source)
at cucumber.runtime.Reflections.hasConstructor(Reflections.java:51)
at cucumber.runtime.Reflections.instantiateSubclasses(Reflections.java:28)
at cucumber.runtime.Runtime.loadBackends(Runtime.java:96)
at cucumber.runtime.Runtime.<init>(Runtime.java:63)
at cucumber.api.cli.Main.run(Main.java:24)
at cucumber.api.cli.Main.main(Main.java:16)
Caused by: java.lang.ClassNotFoundException: cucumber.io.ResourceLoader
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)
... 10 more
看起来你错过了cucumber核心库 尝试将以下内容添加到依赖项中
信息杯
黄瓜核
1.2.5
?你错过了黄瓜核心库。你是如何管理你的类路径的?如果你认为一个jar文件丢失了,你的类路径中有哪些jar文件?
Feature: AddUser
In order to perform operations on the library system
I want to be able to add a valid user.
Scenario: Add unique user
Given I have entered a username Ali
And I have entered a password 22
And I have entered a given name ali
And I have entered a family name abbas
And I have entered a middle Initial F
And I have entered a email ali@gmail.com
And I have entered a roleID Member
When I press Create User
Then a new user should be added
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-core</artifactId>
<version>1.2.5</version>
</dependency>