Add steps by recording

This exercise describes how to add steps to your test by recording. Recording enables you to perform the test as a user would, enabling UFT to create test steps for you as you go.

Record steps for the FlightFinder action

This procedure describes how to record UFT test steps for finding a flight in the MyFlight app.

Do the following:

  1. Start with the MyFlight solution and test open to the FlightFinder action.

  2. Open the MyFlight app, and log in. Enter john and hp as the username and password.

    For more details, see Explore the sample MyFlight application.

    Tip: Arrange your windows so that you can view the MyFlight app and the tutorial at the same time.

  3. In UFT, select Record > Record and Run Settings.

    Then, select Record and run test on any open Windows-based application.

  4. In UFT, click the Record toolbar button .

    The main UFT window is hidden, and the Recording toolbar appears, displayed together with the MyFlight app.

  5. In the MyFlight app, search for a flight from Los Angeles to Sydney.

    Select a future date, Business class, and 2 tickets.

    Note: We recommend selecting a date far in the future.

    You'll be making copies of this test for subsequent exercises, and will run into errors if your date is in the past at that point.

  6. Click FIND FLIGHTS to display the SELECT FLIGHT page.

  7. On the recording toolbar, click to stop recording.

  8. Save your test, and continue with Add steps from the Toolbox pane.

    Tip: If you plan on running this test on a different day, update your datePicker step in the Editor to avoid having to change the date each time.

    For details, see Update your step to run on a different day.

Back to top

View your steps in the Keyword View

In the Keyword View, the FlightFinder action should look like this:

Back to top

View your steps in the Editor

In the Editor, your recorded steps in the FlightFinder action should look like this:

WpfWindow("Micro Focus MyFlight Sample").WpfComboBox("fromCity").Select "Los Angeles"
WpfWindow("Micro Focus MyFlight Sample").WpfComboBox("toCity").Select "Sydney"
WpfWindow("Micro Focus MyFlight Sample").WpfCalendar("datePicker").SetDate "29-May-2018"
WpfWindow("Micro Focus MyFlight Sample").WpfComboBox("Class").Select "Business"
WpfWindow("Micro Focus MyFlight Sample").WpfComboBox("numOfTickets").Select "2"
WpfWindow("Micro Focus MyFlight Sample").WpfButton("FIND FLIGHTS").Click

Update your step to run on a different day

If you plan on running this test on a different day, edit the datePicker step value to avoid having to change the date each time.

In this example, update the following line:

WpfWindow("Micro Focus MyFlight Sample").WpfCalendar("datePicker").SetDate "29-May-2018"

to:

WpfWindow("Micro Focus MyFlight Sample").WpfCalendar("datePicker").SetDate left(DateAdd("d", 2, now()),11)

Back to top

Next steps: