Saturday, 3 September 2011

Expert View in QTP

This article explains the details about the expert view in QTP.
Creating new steps in a Test using Expert view.We can insert new step into QTP by anyone of the following ways.
01.Use "STEP GENERATOR"
02.Enter steps manually in expert view
03.Record steps on the AUT
04.Use the ACTIVE SCREEN
05.Enter the steps directly
Using Step Generator:Step Generator can be accessed through Insert> Step> Step Generator from the menu.Steps are organized according to three categories.Test Objects,Utility objects,Functions.To define a new step we need to complete Object or Library,Operation and Arguments fields.We can also insert the additional steps by selecting INSERT ANOTHER STEP checkbox and clicking on OK button.
Manual Entry of Steps:Steps can also be added directly to tests and components with the expert view.Expert view also provides Statement completion,Auto expand VBScript syntax,Content-sensitive help.
By Using Statement completion feature presents options for finishing the VBScript file.The feature useful in the following contexts.
01. When you type a class followed by a parenthesis.QTP displays the test  objects in the object repository  for that class.
02.When you type a object followed by a dot,QTP displays the child objects and methods for that objects.
03.When a method is typed QTP displays the arguments for that method.
Expanding VBScript Syntax:The AUTO EXPAND VBSCRIPT SYNTAX feature returns VBScript statements that match characters you typed.You trigger the feature by typing some initial characters and then pressing the space key.QTP looks for VBScript statements that match the initial characters you typed.If only one statement fits the criteria, that statement is entered automatically. If multiple options exist, a dialog is opened in which you select your choice.If the VBScript statement has a closing keyword as well as an opening keyword (e.g., FOR…NEXT) the closing keyword will also be entered automatically into the script.
Launching Context-Sensitive Help:QTP’s online help is context-sensitive. This means that the help page displayed will differ depending on where the cursor is.You can use context-sensitive help to retrieve the description of any object, method, or statement in your script.To open context-sensitive online help, place the cursor on the desired item and select HELP>QUICK TEST PROFESSIONAL HELP from the menu or type F1. The QUICK TEST PROFESSIONAL HELP window opens to a page describing the item you elected.
With Statement:The VBScript WITH statement allows you to perform a series of operations on the same object.By using the WITH statement, you can group related steps together to make the script easier to read.To convert a script so that sequential steps related to the same object are grouped together using a WITH statement, select EDIT>APPLY “WITH” TO SCRIPT from the menu.To return the script to its previous format, select EDIT>REMOVE “WITH” STATEMENTS  from the menu.
Basic Debugging:Once you have created the script for your test or component, you will need to debug it to ensure that it is free of errors.QTP provides debug features to help you perform each of the following:
Find syntax errors.Execute a script from a desired step,Add breakpoints,Execute single steps.
Finding Syntax Errors: QTP will check your script for syntax errors whenever you switch from the Expert View to the Keyword View. The SYNTAX ERRORS window opens, displaying the following information for each error found in your script:Action Name,Line,Description.To navigate directly to an error in your script, select the error and click GO TO ERROR.
Executing Steps from a desired step:The RUN FROM STEP option allows you to execute a QTP script starting from any step in the script.To use this option, place the cursor at the desired starting step and select TEST>RUN FROM STEP.Note: You will need to manually navigate the AUT to the state expected by the step in your script.
Adding Breakpoint:Breakpoints allow you to suspend a run session at a pre-determined place in the script in order to inspect the run-time state of your application.To set a breakpoint, place the cursor on the desired step and select DEBUG>INSERT/REMOVE BREAKPOINT. The breakpoint symbol is displayed in the left margin of the script.To remove the breakpoint, place the cursor on the step and select DEBUG>INSERT/REMOVE BREAKPOINT again.When you are done debugging, you can clear all breakpoints from a script by selecting DEBUG>CLEAR ALL  BREAKPOINTs.
Executing Single Steps:The step commands in the DEBUG menu allow you to execute a single step of a script. These commands are available once a run session has been paused.The commands are Step Into,Step Over,Step Out.

0 comments:

Post a Comment

 
Back To Top