You are on page 1of 101

Comparision between QTP And WinRunner

SR.
NO. WINRUNNER QTP
It is a product of Mercury
1 Interactive It is a product of Mercury Interactive/HP
2It is a Windows Based Application It is a Windows Based Application
3It supports only Windows Based It supports both Windows Based
Application Application and Web Application
4It doesnot support test on .Net It supports test on .Net
Application Application
5DataTable and ActiveScreen Views DataTable and ActiveScreen Views
are Absent are Present
6Scripting Language is TSL-Test
Scripting Language Scripting Language is VB(Visual Basic) Scripting
7It doesnot support test on ERP
packages(SAP,Peoplesoft,Oracle It supports test on ERP
abs) packages(SAP,Peoplesoft,Oracle abs)
VIEWS IN QTP

By default five views are visible on QTP screen:


1.Keyword View
2.Expert View
3.Active Screen
4.Data Table
5.Information
Other two views are:-
6.Debug Viewer
7.Missing Resources
VIEWS IN QTP

 Keyword View:Place to Develop Code by


selecting objects(keyword)
 Expert View:Developing Code Manually
 Active Screen:Provides Snapshots for each

line of code.
 Datatable:Place to store all test data or inputs
 Information:Provides information for

Syntactical Errors
1.Keyword View
2.Expert View
3.Active Screen
4.Data Table
5.Information
Composite View
1.Debug Viewer
2.Missing Resources
Add - Ins
 It is the First Screen Which appears after
opening the QTP i.e. Add –in Manager
Add In
 Add in is use to identify particular technology
objects.

 By Default three Add –In’s are Available:-


 ActiveX
 Visual Basic
 Web

Other Add ins can also be added like


java,.Net.etc
Object Repository
 Object Repository is a place where QTP stores
learned objects
 Object Repository: displays a tree of all objects in

the current component or in the current action or


entire test
 A local object repository stores objects in a file

that is associated with one specific action, so that


only that action can access the stored objects
 A shared object repository stores test objects in a

file that can be accessed by multiple tests.


Object Repository
STLC-Software Testing Life Cycle

 Two Types:
 1.Manual
 2.Automation
STLC-Software Testing Life Cycle
 Automation:
 1.Requirement Feasiblity
 2.Developing Test Scripts
 3.Enchancing the script
 4.Debugging the script
 5.Executing the script
 6.Collect the results
 7.Result Analysis
 8.Find the Bugs
 9.Log the Bugs
Object Identification
 QTP recognizes all objects in the Application
under test using the set of mandatory
properties that it stores for all Test Objects
while recording. If QTP is not able to
recognize the objects using the set of
mandatory properties it uses object
identification to assign properties to that
Object using following procedure:-
Object Identification
Object Identification
Object Identification
Record and Playback
• We can Record(F3) the events and later it can
be played back(F5)
• Types of Recording:
1. Normal Recording
2. Analog Recording
3. Low Level Recording
• It gives 2 options:
 Record and run test on any open windows-based
application
 Record and run on specific application.
Record and Playback
 For playback just run the script.
Record and Playback
• Steps:
1. Click on “Record” button.
2. Select “Record Specific application”.
3. Click on “+” icon.
4. Click on “OK”
5. Click on “Apply”
6. Click on “OK”
7. Perform some action on application.
8. Click on “Stop” button.
9. Click on “Run”.
10. Click on “OK”
Synchronization
• When we run test,time taken by different object
may vary.
• Three ways of using synchronization:
 Synchronization Timeout.
 It works with seconds
 File/Settings/Run
 It is applicable for all line of code
 It depends on task.
 Use EXIST or WAIT statements.
 It works with seconds
 Syntax: wait xx
 It is applicable for on a point
 It depends on time
Synchronization
 Synchronization point
 It works with milliseconds
 In record mode,Click Insert,Click Synchronization
point,Select the object where we want
synchronization point then specify the timeout
period in milliseconds.
Virtual Objects
 Virtual objects are used to give functionality
name to a object.
 A virtual objects are collected and it is

stored in the VirtualObject Manager.


Virtual Objects
• Steps:
– Tools>Virtual objects>New Virtual Object
– Select class name
– Click Next
– Click Mark Object
– Mark Object with +
– Click on next>next
– Provide appropriate functionality name in Name edit
box
– Provide the appropriate family name in VO collection
box
– Click Next ,check no and then click Finish
Checkpoint
• Checkpoint is a verification point that
compares the current value for a property
with the expected value for that property.
• Types of checkpoint:
• Standard Checkpoint:Checks values of an object.
• Text Checkpoint:Checks that a text string is displayed correctly
and at specified location.
• Text Area Checkpoint:Checks that a text string is displayed
correctly and at specified location.
• Bitmap Checkpoint:Checks an area of an application
• Database Checkpoint:Checks the contents of databases
• Accessibilty Checkpoint
 XML Checkpoint:Checks the data content of XML documents
Text Checkpoint
• In record mode,choose
Insert>Checkpoint>Standard Checkpoint.
• Select the object .

• Click “OK”
• Click on notepad symbol.

• Enter the Expected Value,click Ok and OK


Framework
In QTP
1. Linear Framework:Just using Record
2. Modular:Developing the code
modulewise(Manual/Record) and enhancing the
code
3. Keyword Driven: Giving object and action a
keyword and using it in code
4. Data Driven:Getting each action and permission
from server
5. Hybrid:Combination of two or more framework
Associate Repository
 It is used when we use function.
 When action is called all four thing are called

viz. code,datatable,active screen and OR


 Instead of that we can use function,where we

just link to a object repository


Associate Repository
 Steps:
◦ Choose Resources>Object Repository>Tools>
Associate Repositories.
◦ Click + icon
◦ Select appropriate file with .tsr extension
◦ Select available action and click->
◦ Click OK
Data Driver/Parameterization
 In simple words it can be defined as “Testing
an application with multiple inputs”

 It allows creating maintainable scripts which


can run with different data every time
Step 1
Step 2

Select data to be
parameterized

Click Parameterize
Step 3
Step 4

Give the
column
name
Step 5
Recovery Scenario manager
 Recovery scenario helps the user as it
indicates QTP with regards to the corrective
action needed to be taken in case of the
unwanted event occurred during the test run
Step 1
Step 2
Click NEW
Step 3 Select event
Step 4 Click hand icon

select window
Step 5

Name of selected
window

Objects of the
window
Step 6

Select
operation
Step 7
Step 8
Step 9

Select post
recovery options
OUTPUT VALUE
 Output value extracts value from certain field
which can later used as input for other fields
during runtime.
 To execute output value we have to first

record the application


Step 1
Step 2

Select the
object
Step 3

Select
property
Step 4
Output Name column is
created
Step 4
Step 6
FUNCTION
 Function can be defined as a group of
code which can be called again and again
when require with no need to write the
code again & again.
 The syntax for function is

Function function_name
{
code
}
End function
Function is called
DESCRIPTIVE PROGRAMMING
 Descriptive programming is used when
we want to perform an operation on an
object that is not present in the object
repository.
 In descriptive programming object is not
added in the object repository.

 Thus the object to be used are identified


using object spy.

 The use of invoke is must in descriptive


programming.
Coding in DP
What is Step Generator
 Step generator is a feature available in QTP
which helps to generate the script without
recording and/or without typing the script in
Expert View.
Steps to use Test Objects:
i)Application Under Test should be opened
ii)Press F7 in Qtp
OR
ii) Go to tool bar of the QTP :
-Insert.
-Step Generator.
-Select Category as 'Test Objects' .
-Insert another step should be selected.

on the 'Step Generator' dialog box.


Steps to add Functions
i)Application Under Test should be opened
ii)Press F7 in Qtp
OR
ii) Go to tool bar of the QTP :
-Insert.
-Step Generator.
-Select Category as ‘Functions‘ .
-Select Library as ‘All’ or ‘Built-in’
-Select Operation as ‘InvokeApplication’.
-Click Value text box for Command for Argument Option.
-In constant Textbox Specify the path of the AUT.
-Insert another step should be selected.
on the 'Step Generator' dialog box.
InvokeApplication
 The Function ‘Invokeapplication’ is used to
Invoke the application Multiple time.
Expert View

Keyword View
QTP
OBJECT SPY
What is Object Spy
 The Object Spy enables you to view both the
run-time object methods and the test object
methods associated with an object and to
view the syntax for a selected method.
 You use the Object Spy pointer to point to an

object.
How to Use
 Keep the application ,on which we want to
use object spy, in an Open state.
 Click the object spy icon on Tool bar
continued

Click On Hand
icon
Continued
 Click on Hand icon in Object spy Window.
 Then Select the Object in the Application by

Pointing the hand icon over it and then


Clicking it once.
Object Highligted
Object Properties

Object
Hierarchy tree

Properties Values
Object Methods
Uses of Object Spy
•DescriptiveProgramming
•Check the Syntax for an object

QTP
Connecting QTP to QC
Prerequisite
 To connect QTP and QC we need to install
TD or QC plug-in .
Steps

1) Click File -> Quality Center Connection.


2)Provide the server URL

3)Click Connect Button


4)Provide the User name & Password

5)Click Authenticate
6)Select the domain and project

7)Click Login
Icon indicates that QTP is connected
to QC
8)Click save As

9)Now all QTP files will be


saved to Quality center
Regular Expressions
 Regular Expressions enable Quick Test to
identify objects and Text Strings with varying
values.
 We can use regular expression only for values

of type string.
Regular Expression
1.Record the code
2.Go to Resources>Object Repository
3.Go to description and click on <#>
4.Change variable data of constant field by *.*
This symbol
indicates
Object is a Regular
expression
QTP
Import & Export
This Statement will create/overwrite
the Output.xls file and will write the
global sheet in it.

Global sheet to be
exported
Note: The XL sheet should not be open when executing the
script.

Output.xls File
The statement will impor
the Entire XL sheet at Run
time
Runtime sheet imported
from Output.xls

You might also like