Мой класс бегуна огурца не может найти мой класс определения шага, но он прекрасно находит файл функций.
Вот снимок моей очень простой структуры проекта:
Файл функции:
Feature: Customer must be able to reach the Home Delivery page by clicking the Home Delivery button
Scenario: Test Home Delivery button
Given PS Restaurants web page is open
When User clicks on Home Delivery button
Then Home Delivery page should load
Класс определения шага:
package stepDefinitions;
import java.util.concurrent.TimeUnit;
public class E_1_US_1 {
@Given("^PS Restaurants web page is open$")
public void ps_Restaurants_web_page_is_open() throws Exception {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
}
@When("^User clicks on Home Delivery button$")
public void user_clicks_on_Home_Delivery_button() throws Exception {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
}
@Then("^Home Delivery page should load$")
public void home_Delivery_page_should_load() throws Exception {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
}
}
Класс Runner:
package runner;
import org.junit.runner.RunWith;
import cucumber.api.junit.Cucumber;
import cucumber.api.CucumberOptions;
@RunWith(Cucumber.class)
@CucumberOptions(
features= {"src/features/Feature_1_1.feature"},
glue= {"src/stepDefinitions/E_1_US_1.java"}
)
public class Runner {
}
Результат выполнения Runner class как тест JUnit:
1 Scenarios ([33m1 undefined[0m)
3 Steps ([33m3 undefined[0m)
0m0.040s
You can implement missing steps with the snippets below:
@Given("^PS Restaurants web page is open$")
public void ps_Restaurants_web_page_is_open() throws Exception {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
}
@When("^User clicks on Home Delivery button$")
public void user_clicks_on_Home_Delivery_button() throws Exception {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
}
@Then("^Home Delivery page should load$")
public void home_Delivery_page_should_load() throws Exception {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
}
Я просто скопировал и вставил вывод в свой класс определений шагов, но он по-прежнему не распознает класс определений шагов. Ранее говорилось, что не было подходящего связующего кода для каждого шага в сценарии, но это исчезло после того, как я закрыл и снова открыл файл функции.