This tutorial is going to provide insight into the keyword view and expert view of Micro Focus UFT.
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 are fall in the same Object Hierarchy. Just to put things in perspective, Object Hierarchy is Object Oriented Concept where a set of objects that 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 inexpert view is GUI object on which the operation is performed along with its complete hierarchy followed by the Operation on the Object and value associated with that Operation
How to develop a Script in Expert View
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 QTP screen when I press Cntrl + spacebar, a list containing all possible properties, methods are 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. 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 Winedit box is displayed select SET
What is Keyword View?
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 displays the hierarchy of the GUI object on which 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
That's all to the Keyword View
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.
In fact, you can perform all operations like create, modifying a step. using the Keyword View but to gain mastery over the tool we will restrict ourselves to the Expert View