Add steps in the Editor

This exercise describes how to add steps to your test directly in the Editor using VBScript code. If you're comfortable with VBscript syntax and familiar with the details of your test objects, the Editor may be a convenient way to build your test steps.

This exercise requires that you've added the relevant object repositories and test objects to your test. For details, see Create object repositories.

Add steps to the FlightConfirmation action

This procedure describes how to add steps to the FlightConfirmation action directly in the Editor.

Find your test object properties

Do the following:

  1. Start with the MyFlightApplication solution and MyFlight test open to the FlightConfirmation action, and the Editor displayed.

  2. If you've already performed Add steps using the Step Generator, delete those steps to add them again in this exercise.
  3. In the Solution Explorer, expand the FlightConfirmation node, and open the FlightConfirmation.tsr object repository.

  4. In the Object Repository Manager window, select the Micro Focus MyFlight Sample object, which is the parent object for all other objects on the FLIGHT DETAILS page. The object's properties are displayed on the right.

    Make a note of the object's name and class, as you'll need to enter these manually in the Editor.

  5. Repeat the previous step for the passengerName and ORDER objects, making note of their names and classes.

Create your step in the Editor

Back in UFT One's Editor, create a statement to enter a passenger name for the flight. Include your test objects' hierarchy, names, and the method details. Separate each section of the statement with periods (full-stops).

Do the following:

  1. On the first line, enter the parent object hierarchy for your first step, using the following syntax:

    <object class>("<object name>").

    In this case, the parent object is the Micro Focus MyFlight Sample app window. Start by entering WpfWindow(, and the rest of the object name will auto-complete.

    Add a closing parentheses and a period after the object name to continue with a child object.

    WpfWindow("Micro Focus MyFlight Sample").

    A dropdown appears, displaying all the methods and child objects available to you.

  2. Scroll down and double-click WpfEdit.

    Then, enter an open parenthesis, and UFT One autocompletes with the passengerName text.

    Add a closing parenthesis and a period to continue with the method.

    WpfEdit("passengerName").

    A dropdown appears, displaying all the methods available to you.

  3. Double-click the Set method to add it to your step.

    Then enter a space, and the passenger name you want to use, in quotes.

    WpfWindow("Micro Focus MyFlight Sample").WpfEdit("passengerName").Set "Mary Sanchez"
  4. Press ENTER to start a new line, and then use the same procedure to add another step to click the ORDER button.

    Add the object hierarchy and names:

    WpfWindow("Micro Focus MyFlight Sample").WpfButton("ORDER").

    Then add the Click method:

    WpfWindow("Micro Focus MyFlight Sample").WpfButton("ORDER").Click

    The Click method has no mandatory parameters, so you don't need to add any more code to this step.

  5. Press ENTER again to start a new line, and add another step to click the NEW SEARCH button.

    Add the object hierarchy and names:

    WpfWindow("Micro Focus MyFlight Sample").WpfButton("ORDER").

    Then add the Click method:

    WpfWindow("Micro Focus MyFlight Sample").WpfButton("NEW SEARCH").Click

    The Click method has no mandatory parameters, so you don't need to add any more code to this step.

  6. Save your test, and continue with Run and analyze your GUI test.

Back to top

View your steps in the Editor

In the Editor, the FlightConfirmation action should look like this:

WpfWindow("Micro Focus MyFlight Sample").WpfEdit("passengerName").Set "Mary Sanchez"

WpfWindow("Micro Focus MyFlight Sample").WpfButton("ORDER").Click

WpfWindow("Micro Focus MyFlight Sample").WpfButton("NEW SEARCH").Click

Back to top

View your steps in the Keyword View

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

Back to top

Next steps: