[英] cucumber jvm CucumberException: No features found at []
问题描述
在我的黄瓜-jvm,Maven,junit安装我有我的testRunner文件作为
package com.lebara.testrunner;
import cucumber.junit.Cucumber;
import org.junit.runner.RunWith;
@RunWith(Cucumber.class)
@ Cucumber.Options(
glue = {com.lebara.stepdefs,com.lebara.framework。 main,com.lebara.testrunner},
features =C:/Users/sarthak.dayanand/Documents/WebRefreshTest/CukeAutomation/LebaraWebAutomationTest1/src/main/resources,
format = { pretty,html:target / cucumber-html-report,json-pretty:target / cucumber-report.json},
tags = {@UserJourney}
$ b b)
public class RunCukesTest {
}
上面提到的目录。
如果我运行它,我会遇到以下异常:
cucumber.runtime.CucumberException:在[C:/Users/sarthak.dayanand/Documents/WebRefreshTest/CukeAutomation/LebaraWebAutomationTest1/src/main/resources/cucumber] ...找不到功能...
如果我删除testrunner中的features选项,它会尝试在与我的testrunner.java相同的目录中查找功能文件
cucumber.runtime.CucumberException:在[com / lebara / testrunner]没有找到特性
pre>
如果我把特性文件放在那里,它工作。
我的问题是为什么我的功能文件不是从我以前的位置,我认为是黄瓜的默认文件结构。
如何让它从那里拿起?帮助赞赏。
解决方案您的测试运行程序和功能文件究竟在哪里?我有以下设置完美的工作:
src / test /
pre>
java /
com / mypackage /
TestRunner.java
StepDefinition.java
resources
com / mypackage /
fancy.feature
Maven / Cuke约定将从tests / java目录和test / resources目录中的功能文件执行测试。我的测试运行器基本上与你的相同,但是选项较少:
import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;
@RunWith(Cucumber.class)
@ Cucumber.Options(format = {pretty})
public class TestRunner {}
希望如果您还没有找到答案,这有助于。
In my cucumber -jvm, Maven, junit Setup I have my testRunner file as
package com.lebara.testrunner; import cucumber.junit.Cucumber; import org.junit.runner.RunWith; @RunWith(Cucumber.class) @Cucumber.Options( glue = {"com.lebara.stepdefs","com.lebara.framework.main", "com.lebara.testrunner"}, features = "C:/Users/sarthak.dayanand/Documents/WebRefreshTest/CukeAutomation/LebaraWebAutomationTest1/src/main/resources", format = {"pretty", "html:target/cucumber-html-report", "json-pretty:target/cucumber-report.json"}, tags = {"@UserJourney"} ) public class RunCukesTest { }
I have my feature file in the above mentioned directory.
If I run it, I get the following exception:
cucumber.runtime.CucumberException: No features found at [C:/Users/sarthak.dayanand/Documents/WebRefreshTest/CukeAutomation/LebaraWebAutomationTest1/src/main/resources/cucumber]...
If I remove the "features" option in the testrunner, it tries to look for feature files in the same directory as my testrunner.java
cucumber.runtime.CucumberException: No features found at [com/lebara/testrunner]
And if I put the feature files there, it works.
My question is why is my feature file not being picked up from my previous location, which I thought to be the default file structure for cucumber - maven setup.
How do I make it pick up from there? Help appreciated.
解决方案Where exactly are your test runner and feature files? I've got the following setup which works perfectly:
src/test/ java/ com/mypackage/ TestRunner.java StepDefinition.java resources com/mypackage/ fancy.feature
The Maven/Cuke conventions will have the tests executed from the tests/java directory and the feature files found in the test/resources directory. My test runner is basically the same as yours but with less options:
import cucumber.api.junit.Cucumber; import org.junit.runner.RunWith; @RunWith(Cucumber.class) @Cucumber.Options(format = {"pretty"}) public class TestRunner { }
Hope this helps if you hadn't already found an answer.
这篇关于的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!