Académique Documents
Professionnel Documents
Culture Documents
3types:
QTP:
Type of the Tool: Functional
Company: Mercury interactive incorporation (HP)
Developed by Mercury
Scripting Language: VB
Versions: 1st. VER. 5.5 released in 2002
Version: 2nd VER. 6.5, 7.6, 8.0,
Version 5th 8.2 released in 2005
Version 6th 9.0 released in 2006
Version 7th and 8th 9.1 and 9.2 released in 2007
Operation systems those are compatible with
QTP
Win 2000 server
Advanced 2000 server
Win 2000 Pro
Win 2003 Server
2003 advanced server
VER 9.2 is compatible with XP Pro.
Add in Manager:
It is a feature provided by QTP which is used
for specifying the environments before you are
entering into the QTP so that, it makes the QTP
compatible with that environment. By default
QTP provides, ActiveX, VB, and Web
applications.
Apart from this, QTP is always compatible with
standard windows environment.
1)Test Pane
It is an area provided by QTP used for
viewing the test script. It also allows the
user to do any kind of modifications on the
test script. It represents the script in 2
views.
A. Expert View:
It represents the script using VB script
language
B. Keyword view:
It represents the script using GUI
(Graphical Users Interface) which is further
divided into 4 parts.
1) Item, 2) operation 3) value 4)
documentation
2) Active screen:
It is feature provided by QTP which shows
the application state for each and every
script statement in terms of screen shots
which is used for the following. 1) To
understand the script easily 2) to enhance
the script easily
3) Data Table:
It is also called ‘Formula-One-Sheet’ which is
developed by the third party and integrated
by the QTP. It is used for the following:
1) Used for holding the test data
2) It has a capacity of importing the test
data from different data sources like excel
sheet, flat files and database.
3) It isolates the test script from the data
source.
4) It provides an API (Application program
interface) to interact with it directly
5) QTP maintains two copies of data tables
1) Design time data table 2) Run time data
table.
(Compares both tables to determine if the
test result is pass or fail)
5)Information View:
It is in the form of GUI and contains 4 tabs
Details: Describes of the each and every line
of ‘test pane’ area
Item, Action, Line
6)Missing Resources pane: Click on View in
the Information View and select Missing
Resources.
It is also in the form of GUI. It contains 2 tabs.
Item and Details.
Item contains missing item in the script.
Details describe the properties of that item.
7)Tool Options:
All the available options are tool options.
View-> Information view:
What ever is given in the script area is given
here. (9.2)
Recording and running feature in ‘QTP’
based application’
2) ‘record and run test on these
Automation,
select the option Analog
Recording,
Select one of the following options:
b. Shared Repository:
It is a common place where one can
store the objects information and can
be associated to multiple tests
Advantage: easy to maintain.
Disadvantage: Comparatively takes
more time during execution
objects)
8) Click on ‘OK’
OBJECT IDENTIFICATION:
1)Mandatory Properties:
2) Assistive Properties:
3) Base Filter Properties:
4) Optional Filter Properties:
5) Ordinal Identifier:
Note:
The Mandatory properties, Assistive properties
and the ordinal identifier that was learnt are
stored in the object repository.
5) ORDINAL IDENTIFIER:
Navigation:
Tools->object Identification->select the
desired environment->select the desired
object class to be configured EX: VB buttons
etc.
OBJECT SPY:
Runtime Objects:
The original objects present in the application
are known as Runtime objects
Test Objects:
Test objects are the references for the runtime
objects created by QTP, used by QTP during
execution in order to identify the runtime
objects.
1) Test planning:
In the test planning phase, the test lead will
identify the areas to be automated and the
automation test engineer will do the
following:
A. Understanding the requirements
B. Analyzing the flows
C. Pre configuration settings to the tool in
order to make the tool ready for further
operations
A. CHECK POINTS:
Image Checks the property values of an Check that the image source file is correct.
Checkpoint image.
Table Checks information in a table. Check that the value in a table cell is correct.
Checkpoint
Page Checkpoint Checks the characteristics of a Web Check how long a Web page takes to load or if a Web
page. page contains broken links.
Text Checkpoint Checks that a text string is displayed Check whether the expected text string is displayed in
in the appropriate place in a Web the expected location in a test object.
page or application.
Text Area Checks that a text string is displayed Check that an area of a dialog box includes text that
Checkpoint within a defined area in a Windows- was entered in another part of the application.
based application.
Bitmap Checks an area of a Web page or Check that a Web page (or any portion of it) is
Checkpoint application after capturing it as a displayed as expected.
bitmap.
Database Checks the contents of databases Check that the value in a database query is correct.
Checkpoint accessed by an application or Web
site.
Accessibility Identifies areas of a Web site to Check if the images on a Web page include ALT
Checkpoint check for Section 508 compliancy. properties, required by the W3C Web Content
Accessibility Guidelines.
XML Checkpoint Checks the data content of XML Check the content of an element to make sure that its
documents. tags, attributes, and values have not changed.
Note: XML file checkpoints are used to check a
specified XML file; XML application checkpoints are
used to check an XML document within a Web page.
Navigation:
Keep the cursor on the desired statement;
select the ‘active screen’
Go to Active Screen; right click in the
Active Screen, select accessibility check
point, select after current step. Click on
OK
Run and analyze results
Navigation:
Keep the cursor on the desired location.
Keep the tool under the ‘record mode’
Activate the menu item ‘insert’
Select the option ‘synchronization point’
Specify the property ‘(enabled)’
Specify the property value ‘(True)’
Specify the extra time in ‘mille seconds’
Click ‘OK’
‘Stop recording’.
Click ‘run’ and analyze the results.
In order to avoid the above navigation,
insert the following statement in the
script where it is needed: (Script
syntax)
Object hierarchy.waitproperty
“property name” property Value, extra
time in mille seconds.
EX: Window (“Flight Reservation”) Wait
Property “Enabled”, true, 15000 ms
Navigation:
1)Through Data Drive Wizard:
Tools -> Data driver->
Select the ‘constant value to be
parameterized’
Click on ‘Parameterize button’
Select step by step parameterization,
Next->
Click on ‘Parameter’ options button
Specify the desired column name
Click on OK
Click on Finish and click OK
Navigation:
2) Through Keyword View:
statement)
6) Utility statements
7) Reporter Statements:
Reporter utility object is used for reporting a ‘User
Defined Message’
UDM to the results window
Syntax for the Reporter Statement’
Reporter.reportevent status,”myreport”,”user
defined message”.
Reporter.reportevent micdon,”Myreport”,”I am the
Best”
Adding comments:
Comments can be inserted into the Test Pane area
just by preceding with an ‘apostrophe OR USE A
WORD REM FOR ADDING COMMENTS
6) Result analysis:
Recovery Scenario:
b) OBJECT STATE:
This trigger event is used for defining a solution to over
come the problematic situation faced by the QTP during
execution that is related to Object State.
Navigation:
Resources-> Recovery Scenario manager-> new scenario-
>Next->Object State->Next->take the hand ICON and
click the pop up window ->OK
->Next->if you want to add the properties, click on
ADD/Remove button, and select the desired properties
to be added
Next
Next
Function Call
Next
Click on browse, select the desired .vbs file
Open -> specify a function name
Then insert the necessary statement in between
‘function’ and ‘end function’
Next
Deselect the check box ‘Add another recovery operation’
Next
Select ‘repeat current step and continue’
Next ‘specify a scenario name
Next select the check box ‘add scenario to current test’
Finish
Click on ‘save’ specify the desired file name with .qrs
extension
Click on ‘save’ and click on close and then click run.
d)APPLICATION CRASH:
It is used for defining a solution to over come a
problematic situation like the application fails during the
execution.
REGULAR EXPRESSIONS:
FRAME WORKS
It is a set of generic guidelines designed by the
experts to accomplish a task in an effective, efficient
and in an optimized way.
There are 4 types of Frame Work:
Linear
Modular
Keyword Driven
Hybrid or Sandwich
2) Modular Framework:
An action is a combination of one or more statements
to perform a specific task that would returns a
resulted action.
Create the components or the Actions
Simple Methods:
Click’ method:
a) ‘
This is used for Clicking on a specified
object
Syntax: Object hierarchy.click[x, y[button]]
b) ‘DBL Click’ method:
This is used for double clicking on a
specified Object
Syntax:
objectHierarchy.dblclick[x,y[button]]
c) Set method:
This is used for setting a value into ‘Edit
box’, Selecting or deselecting a ‘check box’,
selecting an ‘option button’ (radio button)
Syntax for ‘Edit box’:
ObjectHierarchy.set”value”
Syntax for ‘Check Box’:
ObjectHierarchy.set”on/off”
Syntax for ‘Option button’ (Radio button)
ObjectHierarchy.set
CASE STUDY 1:
Develop a script for entering the EName,
EAge, ESal, EDesignation and clicking on
Submit button.
Script:
Vbwindow(“EMP”).vbedit(“EName”).set”Jaya
”
Vbwindow(“EMP”).vbedit(“EAge”).set”49”
Vbwindow(“EMP”).vbedit(“ESal”).set”$100.0
00”
Vbwindow(“EMP”).vbedit(“EDesignation”).set
”QAManager”
Vbwindow(“EMP”).vbbutton(“Submit”).click
CASE STUDY 2:
Develop a script for selecting the check
box for ‘testing tools’, ‘live projects’, ‘sql’
server in ‘Orbit’ form and clicking on
‘submit’ button.
Vbwindow(“ORBIT”).vbCheckbox(“TestingT
ools”).set”on”
Vbwindow(“ORBIT”).vbCheckbox(“LiveProje
ct”).set”on”
Vbwindow(“ORBIT”).vbCheckbox(“SQL”).set
”on”
Vbwindow(“ORBIT”).vbCheckbox(“MultiMed
ia”).set”off”
CASE STUDY 3:
Develop a script for entering a ‘Cast’, ‘Age’,
selecting the ‘gender’ and clicking on ‘search
button’ in form 1.
Vbwindow(“From1”).vbEditbox(“Cast”).set
“A”
Vbwindow(“From1”).vbEditbox(“AGE”).set
“50”
Vbwindow(“From1”).vbRadioButton(“Male”).s
et
Vbwindow(“From1”).vbButton(“Search”).Click
d) Select Method:
This is used for selecting an item in a ‘combo
box’ or ‘list box’.
Syntax: objectHierarchy.select”item name”
CASE STUDY 1:
Develop a script for entering a ‘name’, ‘age’,
selecting ‘from’, ‘to’, and setting a ‘train number’
and selecting the ‘gender’ and ‘clicking on
Submit button’ in ‘Res’ Form
Vbwindow(“Res”).vbEdit(“Name”).set ”Jaya”
Vbwindow(“Res”).vbEdit(“Age”).set ”49”
Vbwindow(“Res”).vbComboBox(“To”).select
“Hyderabad”
Vbwindow(“Res”).vbComboBox(“From”).select
”New Delhi”
Vbwindow(“Res”).vbEdit(“Train #”).set ”9”
Vbwindow(“Res”).vbRadioButton(“Female”).set
Vbwindow(“Res”).vbButton(“Submit”).click
e) Activate Method:
This is used for activating a
window/application/browser
Syntax: objectHierarchy.activate
Vbwindow(“form1”).activate
f) Close Method:
This is used for closing a
window/application/browser
Syntax: ObjectHierarchy.close
Vbwindow(“form1”).close
ev = r*q
VbWindow("Product").vbButton("CAL").click
AV =
VBWindow("product").VBEdit("Amount").getROproper
ty("Text")
if (EV = AV) then
reporter.reportevent micpass,"MyReport","Pass"
Else
reporter.reportevent micFail,"MyReport","Fail"
End if
CBOOL:
This is used to converting a value into a Boolean value
CINT:
This is used to converting a value into an integer value
CDBL:
This is used to converting a value into a double value
or float
LTRIM:
This is used for trimming the left side spaces
RTRIM:
This is used for trimming the right side spaces
TRIM:
This is used for trim both side spaces
MID:
This is used for returning a sub-string
LEFT:
This is used for returning a LEFT sub-string
Dim a, b
a = “I am Great in Testing”
b = Left (a, 8)
msgbox(b)
RIGHT:
This is used for returning a RIGHT sub-string
Dim a, b
a = “I am Great in Testing”
b = Right (a, 8)
msgbox(b)
ROUND:
This is used for rounding a decimal value to nearest
integer
CEALL:
It is used for ceiling the value (Highest nearest integer
is Ceiling)
FLOOR:
It is used for flooring the value. (Lowest nearest
integer)
Import Sheet:
It is used for importing a specified sheet from an
‘Excel’ file to a specified location in the runtime Data
Table.
Syntax:
Datatable.importsheet”Full Path”, source Sheet ID,
Destination Sheet ID
Export Method:
It is used for exporting all the sheets in the
runtime Data table to a specified location in the
hard Disk
Syntax:
Datatable.export”Path of the location with the file
name .xls extension”
DESCRIPTIVE PROGRAMMING
If the description is described in the program itself then it
is known as DESCRIPTIVE Programming.
Script:
Dialog("Text:=Login").WinEdit("Attached Text:=Agent
Name:").Set "Jaya"
Dialog("Text:=Login").WinEdit("Attached
Text:=Password:").SetSecure
"47257f2ff7200f866a1a9285db8ad6dac9bd7932"
Dialog("Text:=Login").WinButton("Text:=OK").Click
ENVIRONMENT VARIABLES
It is concept provided by QTP to declare and
define Variable once and use them in the
multiple tests in the same environment.
There are two types of Environment Variables.
A) Built in Variables, B) User defined Variables.
A)Built in Variables:
These are the variables already declared
and defined by the QTP and associate to
each and every new test so that one can
use them directly in the script using
following Syntax:
Environment.value(“VariableName”)
B) User Defined Variable:
Apart from built in variables, if the user
wants to declare and define a variable
which can be used commonly across many
tests then he can declare them as ‘User
defined Variables”. If the Variables are
declared in the TEST then it is known as
‘Internal Variables’. If the Variables are
imported from an External file, then
those Variables are called as ‘External
Variables’.
Syntax: EX:
VbWindow("Form1").VbEdit("val1").Set
environment.Value("SAI")
VbWindow("Form1").VbEdit("val2").Set
environment.Value("X")
VbWindow("Form1").VbButton("ADD").Cli
ck
VbWindow("Form1").VbButton("SUB").Clic
k
VbWindow("Form1").VbButton("MUL").Cli
ck
VbWindow("Form1").VbButton("DIV").Clic
k
INPUT/OUT PUT PARAMETERS
Syntax:
bWindow("Form1").VbEdit("val1").Set
parameter("A")
VbWindow("Form1").VbEdit("val2").Set
parameter("B")
VbWindow("Form1").VbButton("ADD").Cli
ck
parameter
("D")=Vbwindow("Form1").VbEdit("Res").G
etROProperty("Text")
BATCH TESTING
Test Batch Runner:
Database Connections
Dim con, rs
Set con=createobject(“adodb.connection”)
Set rs=createobject(“adodb.recordset”)
Con.provider=”Microsoft.jet.oledb.4.0”
Con.open=”D:\nagesh\database.mdb”(give the
path of the database)
Rs.open”select*from DATABASE TABLE
NAME”, con (give the name of the table)
Do while not rs.eof (end of file)
Vbwindow(“form1”).vbedit(“val1”).set
rs.fields(“v1”)
Vbwindow(“form1”).vbedit(“val2”).set
rs.fields(“v2”)
Vbwindow(“form1”).vbbutton(“add”).click
rs.movenext
Loop
-----------------------------------END of Automation----------------------------------