The Keyword View provides an easy way to create, view, and modify tests in a graphical easy-to-use format.
About Working with the Keyword View in HP’s QTP:
The Keyword View enables you to create and view the steps of your test in a modular, table format. Each step is a row in the Keyword View that is comprised of individual, modifiable parts. You create and modify steps by selecting items and operations in the Keyword View and entering information as required. Each step is automatically documented as you complete it, enabling you to view a description of your test in understandable sentences. You can also use these descriptions as instructions for manual testing, if required.
You can use the Keyword View to add new steps to your test and to view and modify existing steps. When you add or modify a step, you select the test object or other step type you want for your step, select the method operation you want to perform, and define any necessary values for the selected operation or statement. Working in the Keyword View does not require any programming knowledge. The programming required to actually perform each test step is done automatically behind the scenes by QTP.
The Keyword View
The Keyword View enables you to create and view the steps of your test in a keyword-driven, modular, table format. The Keyword View is comprised of a table-like view, in which each step is a separate row in the table, and each column represents the different parts of the steps. The columns displayed vary according to your selection.
Actions are the highest level of the test hierarchy. They contain all the steps that are part of that action, and can include calls to other reusable actions. In the Keyword View, you can use the Action toolbar to view either the flow of all the top-level action calls in the test, or the content of a specific action. You can also display an action by double-clicking it in the Test Flow pane.
You can insert a new action, a call to an action, or a copy of an action, to your test.
Tip: You can copy and paste or drag and drop actions to move them to a different location within a test.
Each action is comprised of steps. Each step is inserted as a row in the Keyword View. For example, the Keyword View could contain the following rows:
These rows show the following three steps that are all performed on the Welcome: Mercury Tours page of the Mercury Tours sample Web site:
- tutorial is entered in the userName edit box.
- An encrypted string is entered in the password edit box.
- The Sign-In image is clicked.
- The Documentation column translates each of the steps into understandable sentences.
For every step in the Keyword View, QTP displays a corresponding line of script in the Expert View. If you select a specific row in the Keyword View and switch to the Expert View, the cursor is located in the corresponding line of the script.
You can use the Keyword View to add steps at any point in your test. After you add steps, you can modify or delete them using standard editing commands and drag-and-drop functionality. You can print the contents of the Keyword View to your Windows default printer (and even preview the contents prior to printing).
In the Keyword View, you can also view properties for items such as checkpoints, output values, and actions, use conditional and loop statements, and insert breakpoints to assist you in debugging your test.
The Keyword View can contain any of the following columns: Item, Operation, Value, Assignment, Comment, and Documentation. A brief description of each column is provided below.
Columns Description:
Item Column:
The item on which you want to perform the step (test object, utility object, function call, or statement). This column displays a hierarchical icon-based tree. The highest level of the tree are actions, and all steps are contained within the relevant branch of the tree. Steps performed within the same parent object are displayed under that same object. Function calls, utility objects, and statements are placed in the tree hierarchy at the same level as the item above them (as a sibling).
You can collapse or expand an item in the item tree to change the level of detail that the tree displays.
- To collapse an item and its sub-items, click the arrow ( ) to the left of the item's icon, press the minus key (-) on your keyboard number pad, press the left arrow key on your keyboard, or right-click the item and select Collapse Sub Tree. The item tree hides all its sub-items and the collapse arrow changes to expand.
- To collapse all the items in the tree, select View > Collapse All.
- To expand an item one level or to its previously expanded state, select it and click the arrow (down arrow) to the left of the item icon, press the plus key (+) on your keyboard number pad, press the right arrow key on your keyboard, or right-click the item and select Expand Sub Tree. The tree displays the details for the item and all its first-level sub-items and the expand arrows change to collapse.
- To expand an item and all its sub-items, select the item and press the asterisk (*) key on your keyboard number pad. The tree displays the details for the item and all its sub-items and the expand arrows change to collapse.
- To expand all the items in the tree, select View > Expand All.
Note: When you use the +, -, and * keys to expand and collapse the Item tree, make sure that the entire row is selected (by clicking to the left of the item's icon) and that a specific column is not selected, before pressing the required key. Otherwise, the keys will not work.
Operation Column:
The operation to be performed on the item. This column contains a list of all available operations (methods, functions, or properties) that can be performed on the item selected in the Item column, for example, Click and Select. The default operation for the item selected in the Item column is displayed by default.
Value Column:
The argument values for the selected operation, or the content of the statement. The Value cell is partitioned according to the number of arguments of the selected operation.
If an argument has a predefined list of values, QTP provides a drop-down list of possible values. If a list of values is provided, you cannot manually type a value in this box.
Assignment Column:
The assignment of a value to or from a variable. For example, Store in cCols would store the return value of the current step in a variable called cCols, which you could then use later in the test.
You can select either Store in or Get from, depending on whether you want to retrieve the value from a variable or store the value in a variable. A Store in X value in the Assignment column is equivalent to an X = <step> line in the Expert View. A Get From X value in the Assignment column is equivalent to a <step> = X line in the Expert View.
Comment Column:
A free text edit box for any information you want to add regarding the step. These are also displayed as inline comments in the Expert View.
Note: You can also enter a comment on a new line below the currently selected step by choosing Insert > Comment.
Note: If you do not see one or more of the columns in the Keyword View, you can use the Keyword View Options dialog box to display them.
Tips for Working with the Keyword View:
- You can use the left and right arrow keys to move the focus one cell to the left or right, with the following exceptions:
- In the Item column, the left and right arrow keys collapse or expand the item (if possible). If not possible, the arrow keys behave as in any other column.
- When a cell is in edit mode, for example, when modifying a value or comment, the left and right arrow keys move within the edited cell.
- When a Value cell is selected, press Ctrl+F11 to open the Value Configuration Options dialog box.
- When the entire step is selected (by clicking to its left), use the + key (expands a specific branch), - key (collapses a specific branch), and * key (expands all branches) to expand and collapse the Item tree.
- When a row is selected (not a specific cell), you can type a letter to jump to the next row that starts with that letter.
Post a Comment