Search This Blog

Monday, May 24, 2010

QTP Automation Test Process

1) Planning

o Analyzing the AUT
o Automation Test Plan Generation
o Automation Framework Implementation
o Generating/Selecting Test cases for Automation
o Collecting Test Data
o QTP Tool Settings Configuration

2) Generating Tests
o Recording
o Keyword driven methodology
o Descriptive Programming

3) Enhancing Tests
o Inserting Checkpoints
o Inserting Output values
o Adding Comments
o Synchronization
o Parameterization
o Inserting Flow Control Statements
o Calling User defined functions and/or Reusable Actions
o Generating Steps though Step Generator
o Inserting Transaction Points
o Regular Expressions

4) Debugging Tests
o Debug Commands & Break Points
o Step by step execution
o Watching Variables
o Changing values of variables

5) Running Tests
o Normal Execution
o Batch Execution
o Through AOM Scripting
o Tests Running through framework
o Scheduled Execution

6) Analyzing Results
o QTP Result window
o Defining our own Results
o Exporting Results
o Deleting Results

7) Reporting Defects
o Manual Defect Reporting
o Tool based Defect Reporting
o Working with Quality Center

Error Handling in QTP

Yet we know about Recovery Scenario & how to use them in our scripts, there is one more magic of qtp by which we can avoid errors in script.This is called error handling.


On Error statement enable or disable error handling.
Now we will discuss two of the error handling stamenst here

1) On Error Resume Next
2) On Error Goto 0

Write bellow mentioned code in notepad & save it as “A.vbs” now run it with command prompt or double click it.

msgbox "I am Good 1"
call one
msgbox "I am Good 2"
function one()
on error resume next
msgbox "Function One start"
happy
msgbox "Function one end"
end function
msgbox "I am Good 3"

This works fine,now do one thing comment “on error resume next” line now again run it what happen an error displayed Type Mismatch “Happy”, yes now I hope you got it what “on error resume next” does .
Actually it is ignoring any error commencing in code or in your script. As in above example when it reaches to line 7 it looks for “happy” which is not declared anwahere so it displays Type Mismatch error but as we use “on error resume next”

Whereas any error displayed in code it just ignores it & move forward for next line.
So with on error resume next error is not corrected it is just ignored & our test continues.

Moreover “on error resume next” is local to a function in which it is called, it will be in effect as long as function is executes and will be nullified when the function finishes execution.

For example :

msgbox "I am Good 1"
call one
msgbox "I am Good 2"
function one()
on error resume next
msgbox "Function One start"
happy
msgbox "Function one end"
end function

function two()
on error resume next
msgbox "Function two start"
happy
msgbox "Function two end"
end function

msgbox "I am Good 3"

so this way we see that this statement is private to each function.

Err Object :

Whenever there is a run time error in the program , the properties of an Err object is filled with information which help to identify & handle error.
After an “On error resume next” statement the Error objects properties are reset to zero or zero-length strings (“”).This error object is an intrinsic it means you need not to declare it in your code before you use it.

msgbox "I am Good 1"
call one
msgbox "I am Good 2"
function one()
on error resume next
msgbox "Function One start"
happy
msgbox "Error Number Is =" &err.number& "and" & "Error Description= " &err.description
msgbox "Function one end"
end function
msgbox "I am Good 3"