Cant run feature in Cucumber(Cucumber 中无法运行功能)
问题描述
我在 Cucumber 中运行某个功能时遇到问题,该功能非常基础,因为它来自教程.
Im having issues running a feature in Cucumber, the feature is very basic as it's from a tutorial.
没有定义,如下:
Feature: Proof that my concept works
Scenario: My first test
Given this is my first step
When this is my second step
Then this is my final step
我的 Cucumber runner 类如下:
My Cucumber runner class is as follows:
package cucumber;
import org.junit.runner.RunWith;
import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
@Cucumber.Options(
format = {"pretty", "json:target/"},
features = {"src/cucumber/"}
)
public class CucumberRunner {
}
我在项目中的外部.jar
文件如下:
Also the external .jar
files that I have in the project are as follows:
我得到的例外是:
线程主" cucumber.runtime.CucumberException 中的异常:失败实例化公共cucumber.runtime.java.JavaBackend(cucumber.runtime.io.ResourceLoader)与 [cucumber.runtime.io.MultiLoader@75d837b6]
Exception in thread "main" cucumber.runtime.CucumberException: Failed to instantiate public cucumber.runtime.java.JavaBackend(cucumber.runtime.io.ResourceLoader) with [cucumber.runtime.io.MultiLoader@75d837b6]
我试图在网上四处寻找解决此问题的方法,但没有任何运气.
I've tried to look around online for the solution to this problem but have not had any luck.
我也和教程的 OP 讨论过,我还在等待反馈,但已经有一段时间了.
I've also discussed with the OP of the tutorial and I'm still awaiting feedback but it has been a while.
推荐答案
我遇到了类似的问题,得到了和你一样的错误.
I ran into a similar issue and got the same error as you did.
首先提一下特征文件的路径features = {"src/cucumber/myfile.feature"}
无论如何,这并没有导致错误.
Firstly mention the path to the feature file
features = {"src/cucumber/myfile.feature"}
Anyway, that didn't cause the error.
要运行你的 Cucumber runner 类,你需要的所有依赖项是
To just run your Cucumber runner class, all the dependencies you need are
黄瓜-junit
cucumber-java
和junit
.
我有一个额外的 cucumber-guice
造成了问题,一旦我删除它,错误就消失了,并且运行成功.
I had an additional cucumber-guice
which was creating the problem and once I removed it, the error went away and runner was executed successfully.
从您提到的图片的链接来看,您似乎没有使用 cucumber-guice
但我仍然建议您删除其他不必要的黄瓜依赖项并重试.
From the link to the image you have mentioned it looks like you are not using cucumber-guice
but still I would recommend you remove other unnecessary cucumber dependencies and try again.
这篇关于Cucumber 中无法运行功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Cucumber 中无法运行功能


- 将 Java Swing 桌面应用程序国际化的最佳实践是什么? 2022-01-01
- 如何使 JFrame 背景和 JPanel 透明且仅显示图像 2022-01-01
- 在 Java 中,如何将 String 转换为 char 或将 char 转换 2022-01-01
- 获取数字的最后一位 2022-01-01
- java.lang.IllegalStateException:Bean 名称“类别"的 BindingResult 和普通目标对象都不能用作请求属性 2022-01-01
- 未找到/usr/local/lib 中的库 2022-01-01
- GC_FOR_ALLOC 是否更“严重"?在调查内存使用情况时? 2022-01-01
- 转换 ldap 日期 2022-01-01
- Eclipse 的最佳 XML 编辑器 2022-01-01
- 如何指定 CORS 的响应标头? 2022-01-01