View – the ability to see something or to be seen from a particular perspective. In UFT context, it is the GUI view to facilitate automation scripting. What if I tell you that apart from general code editor UFT also offers a Keyword view for non-programmers? Yeah! As simple as that. But let’s first look at the code editor or the ‘Expert View‘!
In laymen terms – Expert View is the editor where you actually write a VB script code, i.e. each line represents a Test Step in VB Script. For e.g.
In the Expert View, UFT displays each operation performed on your application in the form of a script, comprised of VBScript statements. The Expert View is a script editor with many script editing capabilities.
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. You can modify the columns displayed to suit your requirements. 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.
- 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,
- 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
Each operation performed on your application during a recording session is recorded as a row in the Keyword View. That’s all to the Keyword View.
If you compare a line of script in QTP, 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 different format. Advanced testers can view and edit their tests (code) in the Expert View. If you focus on a specific step in the Keyword View and switch to the Expert View, the cursor is located in that corresponding line of the test. Any changes made in the Expert View are automatically synchronized with the Keyword View.
The following diagram shows how the same object hierarchy is displayed in the Expert View and in the Keyword View:
The image below explains how the different parts of the same step are represented in the Keyword View and the Expert View.