目录
Cucumber的数据驱动
首先,我们看下不使用数据驱动的例子
Login.feature
Feature: Login Action
Scenario: Successful Login with Valid Credentials
Given User is on Home Page
When User Navigate to LogIn Page
And User enters username and password
Then Message displayed Login Successfully
Scenario: Successful LogOut
When User LogOut from the Application
Then Message displayed LogOut Successfully
LoginSteps.java
package steps;
import io.cucumber.java8.En;
/**
* @Author: Lulu
* @Description: Login Action Step
* @DateTime: 2022/6/11 22:28
**/
public class LoginSteps implements En{
public LoginSteps() {
Given("^User is on Home Page$", () -> {
System.out.println("User is on Home Page");
});
When("^User Navigate to LogIn Page$", () -> {
System.out.println("User Navigate to LogIn Page");
});
Then("^Message displayed Login Successfully$", () -> {
System.out.println("Message displayed Login Successfully");
});
When("^User LogOut from the Application$", () -> {
System.out.println("User LogOut from the Application");
});
Then("^Message displayed LogOut Successfully$", () -> {
System.out.println("Message displayed LogOut S