qtp - a handbook
TRANSCRIPT
-
7/27/2019 QTP - A Handbook
1/8
Recovery Scenarios:
Unexpected events, errors, notifications, app crashes during run session can stop the execution pre-
maturely and effect at worst where the automation suite is running unattended. To, overcome the
situation QTP provides a feature called Recovery Scenarios.
R.C consists of :
1. Trigger Event Event that interrupts run session like unwanted pop-up, error notification,
application crash .
2. Recovery OperationAn operation which is performed to enable QTP to continue the run session
even when triggered event firesd/interrupt the run session. For e.g.clicking on OK button ow
popup, restarting windows etc.
3. The instructions on how QuickTest should proceed after the recovery operations have been
performed, and from which point in the test QuickTest should continue, if at all.
For example, you may want to restart a test from the beginning, or skip a step entirely and continue
with the next step in the test.
Smart Identification
If QTP is unable to find any object that matches the learned object description, or if it finds more
than one object that fits the description, then QuickTest ignores the learned description, and uses
the Smart Identification mechanism to try to identify the object.
When QTP is unable to identify the object with the defined properties in OR, Quickest uses the
Smart Identification definition (if defined and enabled) to identify the object.
Using Smart Identification dialog box , we can create and modify the Smart Identification
definition that QTP uses for a selected test object class.
The Smart Identification mechanism uses two types of properties:
Base Filter Properties. The most fundamental properties of a particular test object class;those whose values cannot be changed without changing the essence of the original object.
For example, if a Web link's tag was changed from to any other value, you could nolonger call it the same object.
Optional Filter Properties. Other properties that can help identify objects of a particularclass. These properties are unlikely to change on a regular basis, but can be ignored if they
are no longer applicable.
Read-Line Method Usage
Function ReadLineTextFile
Const ForReading = 1, ForWriting = 2
Dim fso, MyFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.OpenTextFile("c:\testfile.txt", ForWriting, True)
MyFile.WriteLine "Hello world!"
-
7/27/2019 QTP - A Handbook
2/8
MyFile.WriteLine "The quick brown fox"
MyFile.Close
Set MyFile = fso.OpenTextFile("c:\testfile.txt", ForReading)
ReadLineTextFile = MyFile.ReadLine ' Returns "Hello world!"
End Function
Dictionary Object:
Methods
1. Add Method (Dictionary)a. object.Add (key, item)
Dim d ' Create a variable.
Set d = CreateObject("Scripting.Dictionary")
d.Add "a", "Athens" ' Add some keys and items.d.Add "b", "Belgrade"
d.Add "c", "Cairo"
2. Exists MethodSet d = CreateObject("Scripting.Dictionary")
d.exists(keyname) Returns true if key exists and False when not.
3. Items MethodReturns an array of all the items that exists in dictionary.
4. Keys MethodReturns an array of all the keys that exists in dictionary.
5. Remove Methodd.remove(key)
Removes a key, item pair from a Dictionary object.
6. RemoveAll MethodThe RemoveAll method removes all key, item pairs from a Dictionary object.
Properties
7. Count Property8. Item Property9. Key Property
-
7/27/2019 QTP - A Handbook
3/8
Object Model Diagram
-
7/27/2019 QTP - A Handbook
4/8
-
7/27/2019 QTP - A Handbook
5/8
-
7/27/2019 QTP - A Handbook
6/8
FileSystemObject Object
Provides access to a computer's file system.
1. BuildPath Method2. CopyFile Method3. CopyFolder Method4. CreateFolder Method5. CreateTextFile Method6. DeleteFile Method7. DeleteFolder Method8. DriveExists Method9. FileExists Method10.FolderExists Method11.GetAbsolutePathName Method12.GetBaseName Method13.GetDrive Method14.GetDriveName Method15.GetExtensionName Method16.GetFile Method17.GetFileName Method18.GetFolder Method19.GetParentFolderName Method20.GetSpecialFolder Method21.GetTempName Method22.MoveFile Method23.MoveFolder Method24.OpenTextFile Method
-
7/27/2019 QTP - A Handbook
7/8
-
7/27/2019 QTP - A Handbook
8/8
Elegant