QTP 8.2 Complete Tutorial
QTP 8.2 Complete Tutorial
www.ramupalanki.com
Q.T.P. 8.2 ( QUICK TEST PROFESSIONAL)
· Support all Win Runner 7.0 Supported technologies including .Net, XML, SAP, People Soft,
Oracle Apps and multimedia technologies.
Make
QTP Testing Process:-
Edit programs with control statement, Data Driven Test. Statements, Reusable
actions--- etc.
VB Script programs as test batch. After required
ADD-IN MANAGER:- These window list out all QTP supported technologies with respect to license.
NOTE:- In QTP, Every test maintains, global excel sheet likes Win Runner. In Win Runner excel
sheet opening is explicit, but In QTP Excel sheet opening Implicit.
Recording Modes:- To convert our manual test case procedure into VB Script program. QTP is
providing 3 Types of modes.
1. General Recording.
2. Analog Recording.
Navigation :-
VISIBILITY MODES :-
Expert View: -
CHECK PIONTS:-
1) Standard Checkpoint: -
We can use this Checkpoint to verify Properties of Objects like as GUI check
5) Priority: Po
7) Test procedure:
Automation Program:-
Standard check point select testable object click “ok” after confirmation Select required
properties with expected values click “OK”.
NOTE :-
(a) One check point allows one object at a time unlike WinRunner.
d) Whenever check point is pass (or) fail, but QTP continues test execution up to end.
(e) If any type of Checkpoint inserted into VB Script QTP is showing a common Syntax as above.
Build :-
Emp. Name
Dept no
OK
Automation Program:-
Window (“Employee”).Activate
Unlike WinRunner every QTP checkpoint is taking two types of expected values form
test engineer’s, such as constant value and parameters (excel sheet column name).
Note2: -
Our checkpoint is executing one tire when our checkpoint expected is constant. Our
checkpoint is executing more than one time. Depending on no of rows in excel sheet.
To compare images, we can use this check point. Unlike use QTP is
supporting static and dynamic images for comparison. But test Engineers have to select multimedia option
in adding manager to compare dynamic images. QTP supports 10 sec. As maximum play time of images.
$ $
For more QTP Realtime Sripts, visit
www.ramupalanki.com
Expected Actual
= = Pass
! = Fail
Navigation:-
Open old Version of build starting recording open expected image in old
version of build Insert menu Check point Bit map Checkpoint show Expected image in
old version in build - click “OK” after confirmation - Select area of image if required Click
“OK” Close old build version Open new build version click run- Analyze result
manually.
Example:
· Create database check point (Current content of database tables selected as expected) Valid
differences
· Run database check point (Current content of database tables selected Actual).
To apply data base testing, Test Engineer’s are collecting below information from development
team. connectivity name in between fortend and backend in our application build Names of
tables and their column. Screens vs. Tables.
Navigation:-
Data Junction - Select SQL statement manually click “Next” click create to select connectivity
(Ex.Flight32) write select statement click finish click “OK” after conformation of Database Table
content Perform Front-end Operation run Database checkpoint analysis results manually.
Navigation: -
For more QTP Realtime Sripts, visit
www.ramupalanki.com
Select position Script Insert menu checkpoint Text checkpoint select Testable
object- click configure if we have to apply testing on selected part object value (using text before and text
after)- Select Test (match case, Ignore spaces, exact match , Text not displayed)- click “OK”.
Navigation:-
Select position script Insert menu checkpoint Text area check point
select value region click “OK” after conformation click configure if we have to apply testing
on selected part Select test to be applied click “OK”.
(a). if Statement :-
If condition Then
-----
------
------
End if
-----
------
------
-----
------
------
-----
------
------
Else
-----
------
------
End if
For more QTP Realtime Sripts, visit
www.ramupalanki.com
(C) While Loop:-
While condition
-----
------
-------
Wend
(D)For Loop:-
-----
-----
-----
Next
(E)Input Statement :-
(F)Output statement
Msgbox(“message”)
Option
explicit Dim x
Sample
Example 1: -
Input xxxx
Output
xxxx
Automation Program:-
Option Explicit
Dim X, Y
Window (“Sample”).Activate
If Y = X * 100 Then
For more QTP Realtime Sripts, visit
www.ramupalanki.com
Reporter.Reportevent 0, “S1”, “Pass”
Else
End if
Inpu
t xxxx Total = Price * quantity
Outpu
Automation t xxxx Program:-
Option Explicit
Dim q, p, and tot
Window (“Shopping”).Activate
tot = Window(“shopping”).Winedit(“total”).getvisibletext
Tot=mid (tot, 2, Len (p)-1)
If
Cdbl(tot) = Cdbl (p) * q Then
Reporter.Reportevent 0, “S1” ,“calc is
pass” Else
End if
Note: - Variable declaration and type conversion are mandatory tasks in VB script.
The re-execution of a test with multiple text data is called data driven
testing or retesting or Iterative testing there are 3 types.
Example: - multiply
Input
1 Expected:-
Input
2 Result = input 1 * input 2.
OK
Automation program:-
Option explicit
Dim I, x, y, r
For I = 1 to 10 Step 1
x=input box (“Enter input1”)
y= input box (“Enter input2”)
Window (“multiply”).Activate
Window (“multiply”).Winedit (“Input1”).set X
Window (“multiply”).Winedit (“Input2”).set Y
Window (“multiply”).Win button (“OK”).click
R = Window (“multiply”).Winedit (“Result”).getvisibletext
If R = X*Y Then
No: of – files
File-size
OK
Xxx KB
Option explicit
Dim I, x, y, tot
For I = 1 to 10 Step 1
Next
-----
-----
------ Build
-------
VB Script
Test data
Example :-
Insurance
Type
Expected:-
If Type is ‘A’ age is focused, If Type is ‘B’ then gender is focused and if any other
Type is Qualification is focused.
Automation program:-
Option explicit
Dim I, x, n
Window (“Insurance”).Activate
N = Window(“Insurance”).Wincombo box(“Type”).getitemcount
Window(“Insurance”).Wincombobox(“Type”).Select X
If x = ‘A’ Then
Else
Window (“Insurance”).wincombobox(“Qualification”).check checkpoint(“Qualifiacaion”)
End if
Next
STEP GENERATION :-
navigation
Navigation: -
In general Test Engineer’s are using Excel sheet oriented data driven
test to validate completeness and correctness our build functionality with multiple inputs value because
QTP is providing a ready made process for these excel sheet oriented data driven test.
For more QTP Realtime Sripts, visit
www.ramupalanki.com
From the above model Test Engineer’s are Populating test data.
In excel sheet through import data from database through typing collected data.
Navigation:-
Populate Test data in Excel sheet convert our manually Test case into
automation Program for sample inputs Tools menu Data driver Select sample Input
value to Parameterize Click “Parameterize” Click “Next” browse excel sheet column
name to replace that sample inputs click “OK” Click “finish”.
To fill Excel sheet with data base content, Test Engineer’s are using below navigation.
Navigation:-
Place mouse pointer on Excel sheet Right click Sheet Import From database-
Specify connective Select specify SQL statement manually Click “Next” Click create to select
connectivity (Ex:-Flight 32) Write Select statement to import data from base Click “finish”.
SYNCRONIZATION POINT:-
1) Wait ()
2) Properties of object
3) Changes in Settings.
(Or)
This function defines fixed waiting time out, but our application operations are
taking variable time to complete.
We can use this concept to define time mapping between Tool and build
with the help of changes in properties of objects in our application build.
Syntax:-
In this situation test Engineer’s are changing the runtime settings of QTP
Navigation:-
Test menu Settings Run tab Change timeout form 20.000 milliseconds to
more Click “Apply” Click “OK”
Above 3 options are require in automation test Execution when our build
background operations are taking more than 20,000 milliseconds of time, because QTS is
maintaining 20,000 milliseconds as default time out.
BATCH TESTING:-
Every test batch consists of multiple test cases with dependency. One test case End
state is base State to next test case, to make batches in QTP .Test Engineer’s are using below statement.
RUNACTION “Action Name [Test name]”
xxxx
----
---- ------
------ -------
------- ---------
- ---
R u n A c tio n ---“x--x x x ” ----------
-------------
S ubTest/R eusabl
-------- e
Action --------
From the above diagram Test Engineer’s are giving Reusable action Permission
to Corresponding sub test.
For more QTP Realtime Sripts, visit
www.ramupalanki.com
Navigation:-
Create automation program individually and same then with Unique test names Open
subtest in that programs list (Ex. batch 8a.m) Step menu- Action properties General tab Select
Reusable action checkpoint click “OK”follow above navigation for all sub Test. To give reusable
Parameter Submission:-
Main Test
-----
------
--------
----------
RunAction “Action [SubTest]”, one
iteration 10, 20, X, Y
------------
-----
-------
Subtest
A, 40
I P P aram eters O/P
Parameters
To create above like i/p, o/p parameters we can follow below Navigation.
Navigation:-
Open Subtest Step menu Action properties Select parameters tab Create required
no of i/p and o/p ParametersUse that Parameters in required place of Sub test program
(Parameter (“Parameter Name”))
Note: - In QTP Test Engineer’s are using reusable Actions Concept for repeatable
Operation in Build. Instead of user defined function in Win Runner
1 to 3 during Recording
To see and Edit Recognization entries of objects and Windows, We can follow bellow
navigation.
This repository maintains entries of objects and windows in Per test mode only. Unlike Win
Runner
Note :- No Extension to VB Script program of Entries files. It support only Per test mode.
Does not support Global GUI map Entries.
Navigation:-
Example:-
Logical Name: Fax order NO.1 Logical Name: Fax order NO.1
{ {
} }
Some times the QTP is not able to recognize objects and windows
in our application build .Due to the utilization of Advanced Technologies/Unknown Technologies. To
recognize that type of object also forcibly. Test Engineers we can follow below navigation.
Navigation :-
Tools menu Virtual object New virtual object Click “Next” Select
expected type depending on the nature of that non recognized object Click “Next” Mark
that non recognized object area Click “Next “after conformation Specify logical Name to
that virtual object Say yes/no to create multiple Virtual objects Click “Finish”.
NOTE:-
QTP maintains Virtual objects information in a storage area is called virtual object manager.
Some times our application build windows consist of more than one
objects as similar. To distinguish this type of objects in test execution. Test Engineer’s are
directing QTP with object identification option in tools menu.
Sample
OK OK
Navigation :-
Tools menu Object identification Select object type Select MSWID (windowId)
NOTE:-
Windows operating system is maintaining ID’s for Every two objects in our application build.
{ {
} }
2) Object state: To Recover build depending on properties of object (Ex. Status bar)
We can follow below steps to create recovery scenario w.r.t our application builds.
Define
Save Recovery Scenario for Future Reference..
define Abnormal situation Click “Next” Select Recovery type Enter required details to recover
from Abnormal situation Click “Next “ Select Post Recovery type continue remaining test
Execution Click “Next” Enter Scenario Name for future reference Click “Finish”.
Scenario Type :-
To define problem when an open application build fails during the test Run.
Recovery Type:-
QTP allows you to define 4 Types of recoveries to recover from above defined Scenario
(or) problems.
After Recovery form specified problem during Test Run QTP allows you to
Select Post Recovery Types for remaining test execution. There are 6 Types of Post recoveries such as.
4) Proceed to Next test iteration means loop (Ex. Data driven test)
NOTE 1:- QTP allows you to Export and Import VB Script programs using ZIP process (To
store VB Script programs with less amount of space in disk)
NOTE 2: - QTP allows you to Rename Actions in VB Script programs one Action means is a
program (or) Path of Program
NOTE 3:- To remove repetation in VB Script statement we can use “With” statement.
Navigation: - Edit menu Apply “With” statement to Script
NOTE 5:- Check points are comparing tester given Expected value with Project Actual. But
output value statements are returning output state of object without any comparison.
NOTE 6: QTP test allows you to divide one VB Script program into multiple
NOTE 7:- QTP 8.2 is supporting Win Runner launching to Run TSL programs. Wise versa is not
possible. Navigation: - Insert menu call to Win Runner Test (or) Function
NOTE 8:- QTP allows you to calculate VB Script execution time using Start and End
NOTE 9:- QTP allows you to debug VB Script program (F11) as short
NOTE 10:- QTP Supports quality center S/W to save VB Script program permanently.
NOTE 11: Object spy used by test Engineer’s to identify reorganization of object (or)
To automate these two coverage’s, Test Engineer’s are using below check points in QTP
CASE STUDY:-
NOTE 1:- To automate functionality test in web pages we can select web option in Add- In-Manager
NOTE 2:- During Website testing, development team and testing team are working in an
offline mode (offline means Local host (or) Local network)
NOTE 3: QTP is restricting record and own test on specified web site if required.
NOTE 4:- If you create check point on link object, QTP maintains below VB Script maintains.
STATEMENT:-
Links level. QTP supports one Link Level or page Links Level.
NOTE 6: QTP Provides Fitter links check in Page Level testing to apply. Check point on all
links (or) Selected links in page.
NOTE 7: To conduct testing on content of web page, Test engineer’s are using text check
point (or) text area check point.
These Check point allows you to apply below test on that selected test.
(1)