IDEA выделяет features, хотя реализация шагов есть и тесты работают
Создал простой проект Selenide + Cucumber, написал feature-файл и реализацию шагов. Тесты работают но в feature-файле идея подсвечивает что шаг не реализован и не позволяет перейти к реализации. Возможно кто-то сталкивался с подобным?
POM:
<build>
<defaultGoal>dependency:copy-dependencies test</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<systemPropertyVariables>
<selenide.headless>true</selenide.headless>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.codeborne</groupId>
<artifactId>selenide</artifactId>
<version>5.7.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>5.1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>5.1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
<version>1.7.13</version>
</dependency>
</dependencies>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.22.2</version>
</plugin>
</plugins>
</reporting>
Feature:
@all
Feature: Test CoopLand page
Scenario: Open page
Given test
Then Check it
Steps:
public class CoopLandSteps {
@Given("test")
public void test() {
open("https://coop-land.ru/");
}
@Then("Check it")
public void check_it() {
if (!$(By.xpath("/html/body/header/div[2]/div/a/img")).is(Condition.exist)) {
Assert.fail();
}
$(By.xpath("//*[@id=\"story\"]")).setValue("TEST");
}
}
Runner:
@RunWith(Cucumber.class)
@CucumberOptions(
plugin={"pretty", "html:target/cucumber-html-report","json:target/cucumber-report.json"},
features = "src/test/java/features",
glue = "steps",
tags = "@all",
dryRun = false,
strict = true
)
public class BaseRunner {
@Rule
public TestRule report = new TextReport().onFailedTest(true).onSucceededTest(true);
@BeforeClass
static public void setup() {
Configuration.headless = true;
Configuration.browser = "chrome";
//Configuration.holdBrowserOpen = true;
Configuration.startMaximized = true;
Configuration.reportsFolder = "target/surefire-reports";
}
}
Ответы (1 шт):
Автор решения: RomanMitasov
→ Ссылка
Это всего лишь несовершенство плагина Cucumber для IDEA.
Попробуйте в аннотациях @Given и @Then названия сценариев оформить как регулярное выражение вот так:
public class CoopLandSteps {
@Given("^test$")
public void test() {
open("https://coop-land.ru/");
}
@Then("^Check it$")
public void check_it() {
if (!$(By.xpath("/html/body/header/div[2]/div/a/img")).is(Condition.exist)) {
Assert.fail();
}
$(By.xpath("//*[@id=\"story\"]")).setValue("TEST");
}
}
Мне помогло. Если не выйдет - смело создавайте issue в поддержке IDEA