Exercise3: Add Steps to the BookFlight Action Using the Step Generator – UFT/QTP Training Tutorial 10.2

In the previous exercise we have seen that How to add step to the FlightFinder action and SelectFlight action using Flight finder page and Select Flight page of the Mercury tours web site.

In this exercise, you will add steps to the BookFlight action by copying and pasting content into the Editor. This is also the way to add step into action. But, this copy and paste do not include value. The value can be added manually for each step using Keyboard view.

At last, we will use the Step Generator to add a single step. This Generator facilitates users to define an entire step in one dialog box, instead of different parts of a step in the various columns of the Keyword View. To do so,

First, open MercuryTours test from UFT and make sure that only the Web Add-in is loaded.

In Start page, go to Recent solutions area and open “Mercury Tours1”. The Mercury Tours1 opens displays the MercuryTours test created earlier.

Second, open the BookFlight action by double-click the BookFlight action in the Solution Explorer. The BookFlight action opens.

BookFlight Action

Third, add steps to the BookFlight action using editor view

Open the Editor view by double-clicking the Editor button.

Place the following code into the editor,

BookFlight Action 2

Fourth, fill the empty step details.

Go to View > Keyword View to open the Keyword View in UFT window.

In the keyboard view,each step of the Documentation column is empty or indicates that the step is clearing a text box. It is just because the steps values are missing. For example, the first step needs to be filled with the passenger’s first name. The details that need to be added are encircled in the figure below.

BookFlight Action 3

In the Keyword View, enter the following Values in the relevant step,

passFirst0: First name or a fictitious first name

passLast0: Last name or a fictitious last name

creditCard: American Express, MasterCard (one word), Visa, Discover, Diners Club and Carte Blanche

creditnumber: Any 8-digit fictitious credit card number

cc_exp_dt_mn: Month values involve two- digit number from 01 to 12 (Month part of the credit card expiration date)

cc_exp_dt_yr: Any year from 2008 to 2010, as a four-digit number (This is the year part of the credit card expiration date)

Fifth, use Step Generator to add step, and to confirm the booking and go back to the Home page.

The last step in BookFlight action to complete the transaction of Book a Flight page is “clicks SECURE PURCHASE”. During a run session, this opens the Flight Confirmation page in the Mercury Tours Web site.

BookFlight Action 4

Sixth, now, use the Step Generator to define a step and go back to the Mercury Tours Welcome page. Click below the last step of Item column to select Step Generator from the Item list. The Step Generator dialog box opens. This process will insert the next step below the last step.

BookFlight Action 5

From the Object drop-down of the Step Generator dialog box, select “Flight Confirmation: Mercury”.

Click the Select Object button, shown in the above figure. The Select Test Object dialog box opens. Expand the Flight Confirmation: Mercury node of the tree. You may need to breakdown the Book a Flight: Mercury node of the tree to view the Flight Confirmation: Mercury node.

Select the home Image object from the step generator and click “OK”. It is a default test object of the Step Generator.

BookFlight Action 6

Using the Step Generator, describe the arguments and values in Keyboard view:

  • Use the Operation option from drop-down lists to define the value in the Operation column. In this step, the default operation for the home test object, Click, is displayed in the Operation box. Although, you could possibly choose a different operation for this test object by clicking the down arrow, Click is the operation needed for this step.
  • Take the Arguments table to describe values for the arguments in the Value cell in the Keyword View. Mandatory, argument name displays with a red asterisk next to the argument name.
  • The Step documentation box is to show instructions for steps.
  • To add next step after this step, select the “Insert another step” check box to open the Step Generator dialog box again after adding this step. In this action, this is the only step you need in, so there is no need to select this check box.

After everything is done, click “OK”. The Step Generator closes and the step is added to the Keyword View.

Go back to the Editor view by clicking on Editor button. It will display the following code in Editor pane.

Browser (“Flight Confirmation: Mercury”) . Page (“Flight Confirmation: Mercury”) . Image (“home”) . Click

Seventh, at last save the test by clicking on “Save” button.


⇓ Subscribe Us ⇓


If you are not regular reader of this website then highly recommends you to Sign up for our free email newsletter!! Sign up just providing your email address below:


 

Check email in your inbox for confirmation to get latest updates Software Testing for free.


  Happy Testing!!!
 

Leave a Comment

Share This Post