-
Notifications
You must be signed in to change notification settings - Fork 80
Creating customized steps
ℹ️ The description here is aimed at skilled Java users creating application customized steps for BDD testers.
You can create your own steps to match your application pages, and to ease the BDD tester's way through test scenario creation. These steps can also ease the work of Java testers.
The steps file is a standard java file, located in the steps/ folder under test/.
The class definition includes public static methods, each specifying the desired step behavior, and each preceded by a mapping to a Cucumber statement, used by the BDD tester when defining scenarios is the feature file.
The mapping uses regular expressions. Read here for more information on Cucumber mapping syntax.
Example: Suppose the java step file contains the step definition
@Then("^I fill user \"(.*)\" and password \"(.*)\"$")
public static void IFill(String user, String password) {
assertEnabled("login.user");
sendKeys(user, "login.user");
sendKeys(password, "login.password");
}
When the BDD tester is creating the scenario in his feature file, this step will appear in the auto-complete pull-down list as
I fill user "(.*)" and password "(.*)"
And the BDD user needs to replace the first (.*) with the user name, and the second, with the password.
The Java tester can use the step as
IFill(username, password);
Both will set the values of the objects defined by login.user and login.password (in the Object Repository) to their respective specified values.
ℹ️ To be able to use operations such as click() and sendText("text") in your step definition, include the statement import static com.qmetry.qaf.automation.step.CommonStep.*;
.
-
Configuration and setup
-
BDD
-
Java