Parameterizing an Action
If you look at the Data Table at the bottom of the QuickTest window in the ActionB test, you will see four tabs: Global, Copy of FlightOrder, Sign_in [ActionA], and ReturnHome [ActionA].Note: If the Data Table is not displayed, choose View > Data Table to display it.
The Global tab is a data sheet whose data is used for the entire test. If five rows of data are displayed in the Global table, the test will run five times. In
addition, you can create data sets for each action, using the relevant action sheet. If you parameterize a step using an action parameter and enter five rows of data in the corresponding sheet, then that action will run five times within each test iteration.
Note: The Sign_in [ActionA] and ReturnHome [ActionA] data sheets are displayed in gray and cannot be edited because each of these data sheets belong to the corresponding called action and can be edited from only the called action’s original test.
In this section, you will create a data set for the FlightOrder action to check how the application handles multiple orders during a single user session.
1 Open the ActionB test.
If the ActionB test is not already open, choose File > Open and browse to ActionB. Click Open.
2 Select a step to parameterize.
Expand (+) Copy of FlightOrder > Welcome: Mercury Tours > Find a Flight: Mercury.
In the toPort row in the Keyword View, click in the Value cell and then click the parameterization icon(<=>). The Value Configuration Options dialog box opens.
Enter the parameter information.
Select Parameter and confirm that the DataTable option is selected.
In the Name box, type ArrivalCity.
You are creating this data set exclusively for the Copy of FlightOrder action.
Therefore, select Current action sheet (local). Click OK to close the Value Configuration Options dialog box.
QuickTest automatically adds the ArrivalCity column to the Copy of FlightOrder data sheet and inserts San Francisco into the first cell of the ArrivalCity column.
3 Parameterize additional steps.
It is not logical for a single customer to fly to two different locations on the same dates, so it makes sense to parameterize the departure and arrival dates.
In the Keyword View, select fromMonth. Use the procedures in step 2 to parameterize the departure date. Make sure to select Current action sheet (local) in the Value Configuration Options dialog box.
In the Keyword View, select toMonth. Use the explanations in step 2 to parameterize the arrival date. Make sure to select Current action sheet (local) in the Value Configuration Options dialog box.
4 Enter the parameterization data in the Data Table.
In the Data Table, click the Copy of FlightOrder tab.
Type Portland in the second row of the ArrivalCity column. Press Enter.
Type Oct in the second row of the departure and arrival date columns.
5 Set the action to run all the data in the local Data Table.
By default, QuickTest only runs one iteration of each action in a test. You want QuickTest to use all the data in the Copy of FlightOrder tab.
Right-click the Copy of FlightOrder action in the Keyword View and choose Action Call Properties. The Action Call Properties dialog box opens.
Select Run on all rows in the Run tab. If a message box opens, read it and then click OK to close it. Click OK to close the Action Call Properties dialog box.
6 Save the test.
Select File > Save or click the Save button.
You have now created a test that signs-in to the Mercury Tours site, submits two flight orders: a flight from London to San Francisco from Dec 29 to Dec 31, and a flight from London to Portland from Oct 29 to Oct 31, and then logs out of the system by clicking the Home link.


No comments:
Post a Comment