即使设计了正确的步骤定义,Cucumber 也无法找到步骤定义
Cucumber is unable to find the Step Definition even it have proper Stepdefinition designed
我正在准备 Selenium Cucumber 框架,但遇到了一个问题。步骤定义路径在胶水中定义为正确,但无法找到黄瓜步骤定义
已安装的 jar:
黄瓜-java,
黄瓜芯,
黄瓜,
小黄瓜,
联机,
硒独立
TestRunner
import org.junit.runner.RunWith;
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
@RunWith(Cucumber.class)
@CucumberOptions(features="src/test/java/features",glue={"src/test/java/stepDefinitions"})
public class TestRunner {
}
文件夹结构
我尝试使用 Cucumber Java 8,但我什至无法获得 Given, When, Then 注释。
尝试像这样更改胶水定义:
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
import org.junit.runner.RunWith;
@RunWith(Cucumber.class)
@CucumberOptions(
features = "src/test/java/features",
glue = "stepDefinitions"
)
public class TestRunner{
}
其中 stepDefinitions
是步骤定义文件的 程序包名称。
无需提供完整路径。
我正在准备 Selenium Cucumber 框架,但遇到了一个问题。步骤定义路径在胶水中定义为正确,但无法找到黄瓜步骤定义
已安装的 jar: 黄瓜-java, 黄瓜芯, 黄瓜, 小黄瓜, 联机, 硒独立
TestRunner
import org.junit.runner.RunWith;
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
@RunWith(Cucumber.class)
@CucumberOptions(features="src/test/java/features",glue={"src/test/java/stepDefinitions"})
public class TestRunner {
}
文件夹结构
我尝试使用 Cucumber Java 8,但我什至无法获得 Given, When, Then 注释。
尝试像这样更改胶水定义:
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
import org.junit.runner.RunWith;
@RunWith(Cucumber.class)
@CucumberOptions(
features = "src/test/java/features",
glue = "stepDefinitions"
)
public class TestRunner{
}
其中 stepDefinitions
是步骤定义文件的 程序包名称。
无需提供完整路径。