自2天以来,我一直在为此奋斗。显示我的测试通过了,但是对于Selenium Webdriver测试,该测试未在Cucumber + java中运行。在控制台中,我收到以下消息
1 Scenarios (1 undefined)
4 Steps (4 undefined)
0m0.000s
You can implement missing steps with the snippets below:
@Given("^User navigate to shopping page$")
public void user_navigate_to_shopping_page() throws Throwable {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
}
@When("^user enters data$")
public void user_enters_data() throws Throwable {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
}
@When("^clicks on search button$")
public void clicks_on_search_button() throws Throwable {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
}
@Then("^product should be displayed$")
public void product_should_be_displayed() throws Throwable {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
}
我写了以下速滑课
package stepDefinition;
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
@CucumberOptions(
monochrome=true,
features = "src/main/resources/feature",
glue="src/test/java/stepDefinition",
tags={"@tag2"},
dryRun = false)
public class TestRunner {
}
我还将附上项目目录结构的屏幕截图
功能文件是
[![Feature: Checking Functionality
This is a demo test
@tag2
Scenario: Test Login
Given User navigate to shopping page
When user enters data
And clicks on search button
Then product should be displayed
最佳答案
您赋予胶水价值的方式不正确。您必须提供java软件包格式。请尝试使用glue = "stepDefinition"
。
如果您当前的stepDefinition包中有一个包,请说出包含代码的步骤。然后胶水变成"stepDefinition.steps"
您应该将功能部件移动到test \ resources文件夹。