Tuesday, June 3, 2008

Smart Identification

When Quick test uses the recorded description, to identify the object, it searches for the object that matches every property value in description.
If Quick test unable to find any object that matches the recorded object description, or if it finds more than one object that fits description and uses the smart identification mechanism to try to identify the objects.

A smart identification mechanism can help Quick test to identify an object, even if recorded description fails due to changes in property values.
In Smart Identification we have to mention the set of base filter and optional filter properties to identify the object in the application.
Smart Identification is required only if mandatory, assistive properties are failed to recognize the object.


Base Filter - Fundamental properties of particular object, those whose values cannot be changed without changing the essence of original object.
Optional Filter - Other properties can help to identify objects of a particular class as they are unlikely to change on a regular basis but which can be ignored if they are no longer applicable.

Library Files

Library files are containing normal VB Script code.
We can load library files by using 2 ways -

1. Choose Test-Settings-Resources tab-Click on + button - browse and select library file-click OK
2. Use Executefile function to load library files at run time.

When we associate a library file with the test, then all functions with in the library are available to the actions presents in the test.
But when we use executefile function to load a library file, then the functions with in the library file are restricted to a specific action.


Ex: ExecuteFile "FilePath"

Sample Script:

execute file "C:\sample.vbs"
x=10
y=5
result=SumofTwoNumbers(x,y)
msgbox (result)

Code in Sample.vbs -

Public Function SumOfTwoNumbers(a,b)
Dim sum
sum=a+b
SumOfTwoNumbers=sum
End Function

Error Handling

Error handling enables us to convert system generated error messages to user defined messages.

"On Error Resume Next" should be used when you know if an error is expected and don't want to raise it. You may want to do different actions depending upon the error that occurred.

Use err.number and err.description to get more details about the error.

How to handle the exceptions

By using Recovery Scenario Manager, we can handle the exceptions occurred while running the test.

Recovery is a concept like exception handling in a programming language, which can be applied when an unexpected failure occurs.


When TO Use:
We should use Recovery Scenario only for unpredictable events, or events that cannot synchronize with a specific step in our test.

4 Exceptions in QTP:
1. Popup Window - A popup window appears in an open application during a test run.
2. Object State - Property of the object changes its state or value.
3. Run Error - A step in the test does not run successfully
4. Application Crash - An open application fails during a test run.

3 Types of Recovery Scenarios:
1. Triggered Events - Trigger is nothing but the cause for initiating the recovery scenario.
2. Recovery Steps - It defines what needs to be done, when recovery scenario has been triggered.
3. Post Recovery Test Run - It defines what need to be done after the recovery action has been taken. It could be repeat the step or move to next step etc..

About Me

My photo
Hi all,I am Arun Singh Rajaputra. I am working as a Project Lead in a reputed organization in Hyderabad, AP, India. I have little bit knowledge on Quick Test Professional and like to share my knowledge to all through this blog.

Subscribe to get updates on this blog

Enter your email address:

NOTE

Some of the posts posted in this blog are collected and most of them have been prepared by me. If any one have objections regarding any copied posts. Please mail me so that I can take a necessary action on that post.