[英]Cucumber-jvm feature file and step definition file implementation issue
I am new to Cucumber framework, and designed one selenium maven project using Cucumber framework. 我是Cucumber框架的新手,并使用Cucumber框架设计了一个硒Maven项目。 But I am struggling to get rid of an issue for last one week , I have explored all possible solutions on internet.
但是我在努力摆脱过去一周的问题,我已经探索了互联网上所有可能的解决方案。 eg.
例如。 putting runner and step definition file under src/test dir and feature file under test/resources dir ..and many thing, I tried everything possible from my end but nothing could help me.
将运行程序和步骤定义文件放在src / test目录下,将功能文件放在test / resources目录下..还有很多事情,我从头开始尝试了所有可能的方法,但是没有任何帮助。 I have shared the git hub link at the bottom.
我在底部共享了git hub链接 。 Here is the issue I am getting -
这是我遇到的问题-
----------------------- issue/error --------------------------------------------- ----------------------- 问题/错误 ------------------------ ---------------------
1 Scenarios ( [33m1 undefined [0m) 3 Steps ( [33m3 undefined [0m) 0m0.000s 1场景([[33m1 undefined。[0m] 3步([[33m3 undefined。[0m))0m0.000s
You can implement missing steps with the snippets below: 您可以使用以下代码片段实施缺少的步骤:
@given("^User is already on login page$")
public void user_is_already_on_login_page() throws Throwable {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
}
@when("^title of login page is Free CRM$")
public void title_of_login_page_is_Free_CRM() throws Throwable {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
}
@then("^user enters username and password$")
public void user_enters_username_and_password() throws Throwable {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
}
project available on git hub - git hub上可用的项目-
https://github.com/GarimaKoushik/com.CRM.cucumber.git https://github.com/GarimaKoushik/com.CRM.cucumber.git
Based on your code of TestRunner class: You need to add package name inside glue attribute. 根据您的TestRunner类代码:您需要在胶水属性内添加包名称。
stepDefinition
and please put your feature file inside folder, not in any package. stepDefinition
,然后将特征文件放在文件夹中,而不要放在任何包中。
You can refer this link :- http://toolsqa.com/cucumber/cucumber-options/ 您可以参考以下链接: -http : //toolsqa.com/cucumber/cucumber-options/
Please try below code 请尝试以下代码
package Runner;
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
@CucumberOptions(
features= "src/main/java/Features/",
glue= {"stepDefinition"},
monochrome=false
)
public class TestRunner {
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.