在黄瓜不能运行功能 [英] Cant run feature in Cucumber

查看:643
本文介绍了在黄瓜不能运行功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



它没有定义,如下所示:

 特性:证明我的概念工作

场景:我的第一个测试
给定这是我的第一个步骤
这是我的第二步
然后这是我的最后一步

我的Cucumber runner类如下:

 包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 文件如下:



http://puu.sh/bzUJ7/972494f696.png



我得到的异常是:



线程main中的异常cucumber.runtime.CucumberException :无法使用[cucumber.runtime.io.MultiLoader@75d837b6]实例化公共cucumber.runtime.java.JavaBackend(cucumber.runtime.io.ResourceLoader)



我试图在线寻找这个问题的解决方案,但没有任何运气。



我还讨论了教程的OP,我还在等待反馈,但是已经有一段时间了。



任何帮助都会感激。

解决方案

我遇到了一个类似的问题, 。



首先提到功能文件的路径
features = {src / cucumber / myfile.feature}
无论如何,这不会导致错误。



要运行你的Cucumber runner类,你需要的所有依赖是



cucmber-junit
cucumber-java
junit



我有一个额外的 cucumber-guice 这是创建的问题,一旦我删除它,错误消失了,并且跑步者成功执行。



从你提到的图像的链接像你没有使用 cucumber-guice ,但仍然建议你删除其他不必要的黄瓜依赖,然后重试。


Im having issues running a feature in Cucumber, the feature is very basic as it's from a tutorial.

It is not defined and is as follows:

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

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 {

 }

Also the external .jar files that I have in the project are as follows:

http://puu.sh/bzUJ7/972494f696.png

The exception that I'm getting is:

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.

I've also discussed with the OP of the tutorial and I'm still awaiting feedback but it has been a while.

Any help would be appreciated.

解决方案

I ran into a similar issue and got the same error as you did.

Firstly mention the path to the feature file features = {"src/cucumber/myfile.feature"} Anyway, that didn't cause the error.

To just run your Cucumber runner class, all the dependencies you need are

cucmber-junit cucumber-java and junit.

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.

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.

这篇关于在黄瓜不能运行功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆