Код: Выделить всё
package runners;
import org.junit.platform.suite.api.ConfigurationParameter;
import org.junit.platform.suite.api.IncludeEngines;
import org.junit.platform.suite.api.SelectClasspathResource;
import org.junit.platform.suite.api.Suite;
import static io.cucumber.junit.platform.engine.Constants.*;
@Suite
@IncludeEngines("cucumber")
@SelectClasspathResource("features")
@ConfigurationParameter(key = GLUE_PROPERTY_NAME, value = "com.steps")
@ConfigurationParameter(key = FILTER_TAGS_PROPERTY_NAME, value = "@smoke")
@ConfigurationParameter(key = PLUGIN_PROPERTY_NAME, value = "pretty, html:target/cucumber-reports.html")
public class JUnit5CucumberTest {
}
История пользователя: как пользователь, когда я нахожусь на странице поиска Google,
я должен иметь возможность искать все, что захочу. и просмотреть соответствующую информацию
@smoke
Сценарий: проверка названия результата функции поиска
При условии, что я нахожусь на странице поиска Google
Когда я ищу «Драматург» "
Тогда в названии должно быть «Драматург»
Код: Выделить всё
public class GoogleSearchTest {
private Page page;
private GoogleSearchPage googleSearchPage;
public GoogleSearchTest() {
this.page = Driver.getDriver();
googleSearchPage = new GoogleSearchPage(page);
}
@Given("I am on the Google search page")
public void i_am_on_the_google_search_page() {
page.navigate("https://www.google.com");
}
@When("I search for {string}")
public void i_search_for(String string) {
googleSearchPage.enterSearchQuery(string);
googleSearchPage.clickSearchButton();
}
@Then("the title should contain {string}")
public void the_title_should_contain(String string) {
BrowserUtilities.validateTitle(page, string);
}
@Then("title should contain {string}")
public void titleShouldContain(String string) {
BrowserUtilities.validateTitle(page, string);
}
}
Код: Выделить всё
com.microsoft.playwright
playwright
1.49.0
io.cucumber
cucumber-java
7.20.1
io.cucumber
cucumber-junit-platform-engine
7.20.1
org.apache.logging.log4j
log4j-core
3.0.0-beta3
org.junit.platform
junit-platform-commons
1.5.2
test
org.junit.platform
junit-platform-suite-api
1.10.0
test
org.junit.jupiter
junit-jupiter-api
5.10.0
test
org.junit.jupiter
junit-jupiter-engine
5.10.0
test
com.fasterxml.jackson.core
jackson-databind
2.15.0
org.postgresql
postgresql
42.7.4
io.cucumber
cucumber-junit
7.20.1
test
src/test/java/runners/JUnit5CucumberTest.java
src/test/ resources/features/Google.feature
Я попытался запустить класс runner и получить тот же результат, что и при запуске файла функции. Я попытался пересобрать проект, исправив зависимости, но не могу заставить этот бегун увидеть тесты. Возможно, я неправильно построил класс бегуна.
Подробнее здесь: https://stackoverflow.com/questions/793 ... t-and-java
Мобильная версия