我目前正在尝试创建我的第一个 Cucumber 测试。在 Java Eclipse 中,我创建了一个包含以下内容的“功能文件”:
Feature: Login functionality DemoQA.com
Scenario: Verify if user is able to login to the DemoQA website
Given A user is on DemoQA.com
When User clicks MyAccount link
Then User is taken to Login Page
When User enters valid username and password
Then User is able to login
Run Code Online (Sandbox Code Playgroud)
我还创建了以下 testrunner 文件:
@RunWith(Cucumber.class)
@CucumberOptions(
features = "src/test/Features/",
glue = {"Tests"}
)
public class CucumberRunner {
}
Run Code Online (Sandbox Code Playgroud)
我还创建了我的 Stepdefinitions:
公共类 LoginStepDefinitions {
@Given("A user is on DemoQA.com") …Run Code Online (Sandbox Code Playgroud)