Keyword and Expert View in QTP/UFT
โก Smart Summary
Keyword View and Expert View are the two ways UFT One shows the same test. Keyword View lays each step out as a table row, while Expert View shows the underlying VBScript line.
Every GUI test in OpenText Functional Testing (UFT One, formerly Micro Focus UFT and originally HP QTP) can be read two ways: as a table of steps or as lines of VBScript. This walkthrough covers the keyword view and expert view of UFT, how each one presents the same step, and how to move between them.
What is the Expert View?
In the Expert View, each line represents a Test Step in VB Script. Consider the following code
Dialog("Login").WinEdit("Agent Name:").Set "Guru99"
An Object’s Name is displayed in parentheses following the Object Type. Here the Object Name is Login and Object Type is Dialog
Objects in Object Hierarchy are separated by a “dot”. Here Dialog and WinEdit fall in the same Object Hierarchy. Just to put things in perspective, Object Hierarchy is an Object Oriented Concept where a set of objects are grouped together in a parent-child relationship. In our case Dialog Box is the Parent Object and WinEdit is the Child Object
The Operation performed on the object is always displayed at the end of the statement followed by any values associated with the operation. Here the word “Guru99” is inserted in the AgentName Edit Box using the Set Method
The syntax for a statement in Expert View is the GUI object on which the operation is performed along with its complete hierarchy, followed by the Operation on the Object and the value associated with that Operation
ParentObject(Name).ChildObject1(Name)...ChildObjectN(Name).Operation
The short video below walks through that statement one element at a time.
Click here if the video is not accessible
⚠️ Naming note: UFT 11.5 renamed Expert View to the Editor, and later versions keep that name. The pane and the syntax are unchanged, so every statement below still applies โ only the label in the product moved on.
How to develop a Script in Expert View
Rather than record and clean up, you can type a step and let statement completion offer the next element. The recording below demonstrates the sequence, and the transcript follows.
Click here if the video is not accessible
Video Transcript with Key Takeaways highlighted
- Suppose my objective is to code the following statement directly in keyword view
- Dialog(Login).WinEdit(Agent Name:).Set Guru99
- In the UFT One screen when I press Ctrl + Spacebar, a list containing all possible properties and methods is shown
- Also, the list shows the objects stored in the object repository
- Select Dialog
- As soon as I open the parentheses, object name login is auto-populated, if there is more than one object for the same object type a list is displayed
- On pressing the dot key a list of all the methods for the Dialog object and its child objects are displayed. Select WinEdit
- On inputting the dot operator a list of methods for the WinEdit box is displayed, select SET
That list is the feature the vendor calls statement completion. It reads the associated object repository, so a step you type by hand identifies exactly the same objects a recorded step would. If the object you expect is missing from the list, it is not in the repository yet โ add it, or write the step with descriptive programming instead.
What is the Keyword View?
The same step looks very different when the test is opened in the table view, as the video below shows.
The Keyword View is comprised of a table-like view where Each step is a separate row in the table and Each column represents different parts of the steps.
- Item Column contains the item on which you want to perform the step. This column uses icons to display the hierarchy of the GUI object on which the operation is performed
- Operation Column contains the operation to be performed on the item.
- Value Column contains the argument values for the selected operation
- HP QTP automatically documents each step for easy understanding in the Documentation Column
- These 4 columns are default but you can also use assignment & comment columns in Keyword View
⚠️ Version note: the Documentation column above belongs to the QTP-era layout. In current UFT One the documented columns are Item, Operation, Value, Assignment and Comment for actions, with Output replacing Assignment and Comment in business components. Right-click the table header and pick the columns you want in the Keyword View Options dialog box.
How to Switch Between the Keyword View and the Editor
Neither view is a separate document. They are two renderings of one action, which is why nothing is lost when you flip between them.
- Open or create an action, a scripted GUI component or a user code file so that its tab is the active document.
- Click the Toggle between the Keyword View and Editor button in the toolbar. The same button moves you back again.
- To choose which view opens by default, go to Tools > Options > GUI Testing > General and set Open actions and scripted GUI components in this view.
Two behaviours are worth knowing. First, position is carried across: put the cursor on a step in one view and it lands on the matching line in the other. Second, from UFT One 2021 R1 onward the view you were using when you closed the product is the view you get when you reopen it.
If you learned the tool on QTP 11 or earlier, the change is only in the plumbing. Back then the two views sat behind tabs at the bottom of the document pane; from UFT 11.5 the toggle lives on the toolbar and the pane itself is called the Editor. Anyone still installing the product should follow the current UFT One download and installation steps rather than QTP-era instructions.
Adding Steps and Programming Logic in the Keyword View
Because the Keyword View writes the VBScript for you, it is the quicker route for a tester who does not code. The vendor is explicit that no programming knowledge is required to work in it.
- Standard step โ pick an object in the Item column, then an operation and its arguments.
- Checkpoint step โ check the state of an object at a chosen point in the flow.
- Output value step โ capture a value from the application for use later in the test.
- Comment โ free text that spans the whole row and appears as an inline comment in the Editor.
- Programming logic โ send information to the run results, synchronize with the application, measure a transaction, or insert conditional and loop statements.
The Assignment column is the one that surprises people, because it maps onto ordinary VBScript assignment.
| Keyword View | Equivalent line in the Editor |
| Store in X | X = the step (the step’s return value goes into the variable) |
| Get From X | the step = X (the variable supplies the step’s value) |
Rows and columns can both be dragged to reorder them, and a few shortcuts speed the table up: Insert adds a step below the selected one, Tab and Shift+Tab move focus within a row, and Ctrl+F11 opens the relevant properties dialog for the selected cell. Steps that need values from a spreadsheet are better handled by parameterization or by driving the test from Excel.
Compare Keyword and Expert View
If you compare a line of script in QTP/UFT, you will observe that the same object hierarchy is displayed in both Expert & Keyword Views and they map to the same operation and argument value.
Essentially, Keyword & Expert view contain the same data but arranged in a different format.
| Aspect | Keyword View | Expert View (the Editor) |
| Format | Table โ one row per step, one column per part of the step | Script โ one VBScript line per step |
| Programming knowledge | Not required | VBScript needed for anything beyond a recorded step |
| Object hierarchy | Shown as icons in the Item column | Shown as dot-separated objects in the statement |
| Documentation of steps | Generated automatically for each row | Added by the tester as comments |
| Loops and conditions | Inserted through programming-logic step types | Written directly as VBScript |
| Best suited to | Building and reordering a straightforward flow | Reusable functions, error handling and framework code |
In fact, you can perform all operations like creating and modifying a step using the Keyword View, but to gain mastery over the tool we will restrict ourselves to the Expert View. That is also where the rest of the UFT One tutorial series spends its time, alongside the VBScript fundamentals the Editor depends on.
