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 中无法运行功能
基础教程推荐
- 在螺旋中写一个字符串 2022-01-01
- 如何强制对超级方法进行多态调用? 2022-01-01
- 由于对所需库 rt.jar 的限制,对类的访问限制? 2022-01-01
- 如何在不安装整个 WTP 包的情况下将 Tomcat 8 添加到 Eclipse Kepler 2022-01-01
- 如何对 HashSet 进行排序? 2022-01-01
- Spring Boot Freemarker从2.2.0升级失败 2022-01-01
- Java 中保存最后 N 个元素的大小受限队列 2022-01-01
- 如何使用 Eclipse 检查调试符号状态? 2022-01-01
- 首次使用 Hadoop,MapReduce Job 不运行 Reduce Phase 2022-01-01
- 如何使用 Stream 在集合中拆分奇数和偶数以及两者的总和 2022-01-01