This exercise describes how to add steps to the Login action using the Keyword View. The Keyword View enables you to select test objects and actions for your steps from a simple grid, and builds easy-to-read step descriptions as you go.
This exercise requires that you've added the relevant object repositories and test objects to your test. For details, see Create object repositories.
This procedure describes how to create UFT One test steps for logging in to the MyFlight app.
Do the following:
Start with the MyFlightApplication solution and MyFlight test open to the Login action.
If the Editor is displayed, click the Toggle between the Keyword View and Editor toolbar button to switch to the Keyword View.
- In the Keyword View's Item column, click ADD NEW STEP, and then select Object from repository...
In the Select Test Object dialog box, expand the tree and select the agentName test object.
Click OK to return to the Keyword View, where the values have been added as the default Set step.
Note: The Documentation column indicates that this step clears the text because you have not yet provided a value.
Click the cell in the Value column, and enter john.
Your string is wrapped in quotes, and the Documentation text is updated accordingly.
Add the next step, to enter a secured password.
- In the Item column, click ADD NEW STEP, and select password.
- Click the Operation column cell, and select All to display all methods. In the list, scroll down and select SetSecure.
Create a secured password value using UFT One's Password Encoder tool. Select Start > All Programs> Micro Focus > Micro Focus UFT One > Tools > Password Encoder. Enter hp as the Password value.
- Click Generate to display the secured password value.
- Copy and paste the Encoded string value into the Value column in UFT One.
Add the last step for this action, to click OK and complete the login.
In the Item column, click ADD NEW STEP, and select OK.
- Save your test, and continue with Add steps by recording.
View your steps in the Keyword View
In the Keyword View, the Login action should look like this:
View your steps in the Editor
Click the Toggle toolbar button to switch to the Editor. The steps in the editor should appear like this:
WpfWindow("Micro Focus MyFlight Sample").WpfEdit("agentName").Set "john"
WpfWindow("Micro Focus MyFlight Sample").WpfEdit("password").SetSecure "5b0bce2fd2c5fdd64271"
WpfWindow("Micro Focus MyFlight Sample").WpfButton("OK").Click
Each step indicates the test object hierarchy and names, the method to perform in that step, and any relevant method property values.