Search for notes by fellow students, in your own course and all over the country.

Browse our notes for titles which look like what you need, you can preview any of the notes via a sample of the contents. After you're happy these are the notes you're after simply pop them into your shopping cart.

My Basket

You have nothing in your shopping cart yet.

Title: Quick Test Professional Notes
Description: Quick Test Professional(QTP) is a automation testing process used in computer industry. This is the notes given by me to the students. It covers entire subject and all the programs given in this book are executed

Document Preview

Extracts from the notes are below, to see the PDF you'll receive please use the links above


25th July,2013

Quick Test Professional
(QTP)

 Tips for generating the basic Vb script for windows based applications
...
Activate
Dialog(“Login”)
...
Set “Roopa”
Dialog(“Login”)
...
SetSecure “******”
Dialog(“Login”)
...
Click
Window(“Flight Reservation”)
...
Manual Testing and
2
...
Manual Testing : Manual Testing is a process in which all the phases of Software Testing Life Cycle
like
a
...
Test Development
c
...
Result Analysis
e
...

 Drawbacks:
1
...

2
...

3
...

4
...

5
...

6
...

2
...

2

 Drawbacks:
1
...
All the areas can’t be automated
...
Functional Tools: QTP,Selenium,Win Runner,…
2
...
Performance Tools: Load Runner,Silk Performer,…

 QTP Introduction:
1
...

3
...


Types of the tool: Functional Tool
...

Versions: 5
...
5,7
...
0,8
...
0,9
...
5,10
...
0 ( latest 11
...


 Add-in Manager: It is provided by the QTP,if you want to enter QTP, we need to select anyone
of the Add-in based on application
...

Web for web based applications
...
The properties and values will be stored under object
repository
...


1
...

2
...

1
...

NOTE1: Local repository extension
...
tsr (test share repository)
...

NOTE4: Local repositories we cannot associate for multiple test and for shared repositories we can
associate
...
Go to the object repository, activate the file menu
...
tsr
...
Go to the object repositories, tools menu, select the option associate repositories, the associate
repositories which cannot be opened, click on add repository button and select the required
...

NOTE1: Above 2nd paragraph is for, only if any local repositories files are deleted)
Shortcut key: object repository (ctrl + R)
3

Vb Script for CALC

1
...

3
...

5
...

7
...


VbWindow(“FORM1”)
...
Set”1”
Vb Window(“FORM1”)
...
Set”2”
VbWindow(“FORM1”)
...
Click
VbWindow(“FORM1”)
...
Click
VbWindow(“FORM1”)
...
Click
VbWindow(“FORM1”)
...
Click
VbWindow(“FORM1”)
...
Click
VbWindow(“FORM1”)
...
Invoke aapplication (or) Systemutil
...

Syntax: Invokeapplication “Application Path”
(or)
4

SystemUtil
...
RepositoriesCollection
...

Syntax: RepositoriesCollection
...


3
...
Remove:
 This utility option is used to remove on a specific repository file
...
Remove “Path of the TSR file”
...
RepositoriesCollection
...

Syntax: RepositoriesCollection
...
Reporter
...

6
...

Syntax: Objecthierarchy
...
BMP”

4th Aug, 2013

QTP LifeCycle:
It contains 6 phases:
1
...

3
...

5
...


Test Planning
...

Enhancing the test
...

Executing the test
...


1
...

1
...

5

2
...

3
...

4
...

5
...


2
...


3
...
Data Driven Test with parameterization:
DDT: It is a concept provided in Automation inorder to implement retesting
...

1
...

2
...

3
...

4
...

5
...

2
...

It can be done in 6 ways:
1
...

2
...

3
...

4
...
QTP)
...
Passing the input and output parameters
...
Passing the input values during execution
...
Declaring User Defined Variavles
...
Through Data Driven Wizard:
Navigation:
6

1
...

2
...

3
...

4
...

5
...

6
...

7
...

8
...

9
...

Syntax: Datatable(“Variable Name”, Sheet Type)
Example:
Invokeapplication “C;\Programfiles\HP\QTP\Flight\app\Flight4a
...
Activate
Dialog(“Login”)
...
Set Datatable(“un”, dtGlobalSheet)
Dialog(“Login”)
...
SetSecure Datatable(“pswd”, dtGlobalSheet)
Dialog(“Login”)
...
Click
Window(“Flight Reservation”)
...
Passing the input values during the execution:
Example:
Dim i,n,v1,v2
n= inputbox(“Enter number of iterations:”)
for I = 1 to n
v1= inputbox(“Enter the value v1:”)
VbWindow(“Form1”)
...
set v1
V2= inputbox(“Enter the value v2:”)
VbWindow(“Form1”)
...
Set v2
VbWindow(“FORM1”)
...
Click
VbWindow(“FORM1”)
...
Click
7

VbWindow(“FORM1”)
...
Click
VbWindow(“FORM1”)
...
Click
VbWindow(“FORM1”)
...
Click
NOTE1:
GetItemCount Property: It is used to count the number of objects
...

Example:
Count the number of objects on a desktop and capture those object names
...
WinListView(“SysListView32”)
...
WinListView(“SysListView32”)
...

Dim i,n,Oname
n= Dialog(“Local Disk(D): Properties”)
...
GetItemsCount()
for i = 0 to n-1
Oname= Dialog(“Local Disk(D): Properties”)
...
GetItem(i)
print(Oname)
Next

5th Aug,2013
NOTE:
GetRO Property: It is used to capture the actual value during the execution
...

8

Example of GetRO Property:
Dim res1,res2,res3,a,,b,c
VbWindow(“Form1”)
...
Set parameter(“V1”)
VbWindow(“Form1”)
...
Set parameter(“V2”)
VbWindow(“Form1”)
...
Click
res1= VbWindow(“Form1”)
...
GetROproperty(“Text”)
msgbox res1
VbWindow(“Form1”)
...
Click
res2= VbWindow(“Form1”)
...
GetROproperty(“Text”)
msgbox res2
VbWindow(“Form1”)
...
Click
res3= VbWindow(“Form1”)
...
GetROproperty(“Text”)
msgbox res3

6th Aug, 2013
Example for GetVisibleText:
result= Dialog(“Login”)
...
and confirmation
message
...

Example:
Window(“Flight Reservation”)
...
ActiveX(“MaskEdBox”)
...
WinComboBox(“FlyFrom:”)
...
WinComboBox(“Fly To:”)
...
WinButton(“Flight”)
...
Dialog(“Flights Table”)
...
Click
Window(“Flight Reservation)
...
WinEdit(“Name:”)
...
WinButton(“Insert Order”)
...
WinEdit(“Order No:”)
...
ActiveX(“ThreedPanelControl”)
...
Active
Window(“Flight Reservation”)
...
Click
9/8/2013

Check Points:
QTP has provided 7 types of check points:
1
...

3
...

5
...

7
...

Text Checkpoint
...

Bitmap Checkpoint
...

XML Checkpoint
...


NOTE: First 6 checkpoints are windows based checkpoint and last one is web based checkpoint
...
Standard Checkpoint: It is used to capturing the actual value, and comparing the expected value
with the actual value, if expected value is equal to actual value result pass, otherwise result fail
...
Text Checkpoint: It is used for checking the text present on a specified object
...
Text Area Checkpoint: It is used for checking the text present on a specified area
...
Bitmap Checkpoint: It is used to capturing the actual Bitmap and comparing the actual Bitmap With
the expected Bitmap
...

5
...
Activate the menu item insert
...
Select the checkpoint type as Database Checkpoint
...
Select the option specify SQL statement manually
...
Click on Next button
...
The database query wizard will be opened
...
Click on create button to create the new connection string
...
The database wizard will be opened
...
Click on new button
...
Select the database type
...
Click on next
...
Click on browse button and specify the data source name
...
Save ODBC Microsoft Access Setup Wizard will be opened
...
Select the Database, click on ok
...
Now select the data source name
...
Now specify the SQL statement
...
Select SQL statement Select *from tablename
17
...


6
...

7
...


Output Values: Capturing something during execution, we can findout result in the runtime data table,
QTP has provided 4 types of output values
1
...

3
...

5
...

Database Output: It is used to capturing the contents from the datatable
...

Text Output: It is used for checking the text present on a specified object
...


Example for Standard Output Value:
VbWindow(“Form”1)
...
Output CheckPoint(“ADD”)
Example for Database Output:
11

DbTable(“DbTable”)
...
xml”)
...
xml”)
Example for Text Output:
VbWindow(“Form1”)
...
Output CheckPoint(“clear”)
Example for Text Area Value:
VbWindow(“Form1”)
...

1
...

2
...

Syntax: Environment
...
User Defined Variable: Replacing the constant value with a user defined variable
...
VbEdit(“Text1”)
...
Value(“V1”)
VbWindow(“Form1”)
...
Set Environment Value(“V2”)
VbWindow(“Form1”)
...
Click
VbWindow(“Form1”)
...
Click
Navigation:
1
...

2
...
Select the tab environment
...
Select variable type as user defined
...
Click on ‘+’ configuration button
...
The Add nNew Environment Parameter Wizard will be opened
...
Specify the name and the value
...
Click on ok
...
Click on Export to create the ‘XML’ file
...
Apply and OK
...
Built-in Variables: These are pre-defined variables, wherever we want in the middle of the script,
directly we can this variables
...
Value(“Local Host Name”)
msgbox res1
res2= Environment
...
Value(“OS Version”)
msgbox res3
res4= Environment
...
Value(“Product Ver”)
msgbox res5
10/8/2013

Data table methods: These are used for performing the operations on the run-time data type
...
Add Sheet: This method is used for adding an extra sheet to Runtime data table
...
AddSheet “Sheetname”
2
...

Syntax: Datatable
...
Import: This method is used for importing the data present in XL files to the run time data table
...
Import “Path of the XL file”
13

4
...

Syntax: Datatable
...
Export: It is used for exporting the data present in the run time data table to a specified location
...
Export “Path of the Excel file”
6
...

Syntax: Datatable
...

7
...

Syntax: Datatable
...
SetNextRow: It is used for making the QTP focus on the Next Row of the currently focused row
...
SetNextRow
9
...

Syntax: Datatable
...
Value Method: Value method is used for getting a value from a specified sheet, specified column and
currently focused row
...
GetSheet: It is used for making the QTP focus on a specified sheet
...
GetSheet(SheetID)
12
...

NOTE:
By default it will return the global sheet row count
...
GetRowCount

Example:
Datatable
...
ImportSheet “d:\td
...
GetSheet(3)
...
VbEdit(“Text1”)
...
Value(“V1”,3)
VbWindow(“Form1”)
...
Set Datatable
...
VbButton(“ADD”)
...
VbEdit(“Text3”)
...
Value(“ev”,3)
If Cint(Expval) = Cint(Actual) Then
14

Datatable
...
Value(“res”,3)= Fail
End if
Next
Datatable
...
xls”,3

11/8/2013

Recovery Scenarios (Exceptional handling):
Whenever we are executing the application, may we face some problematic situations like
1
...

3
...


Problems related to the Pop-up window
...

Problems related to the TestRun error
...

1
...

3
...


Pop-up window trigger event
...

TestRun error trigger event
...


NOTE: Extension of the recovery scenarios is
...

12/8/2013

Working with Databases:
NOTE:
ADODB: The ADO(Activates Data Objects) is used to create a connection to a data source
...

NOTE:
ADODB
...

NOTE:
MOVENEXT: This method is used to move current field to next field
...
Connection”)
Set Rs = CreateObject(“ADODB
...
Provider = “Microsft
...
OleDb
...
0”
Con
...
mdb”
Rs
...
EOF
VbWindow(“Form1”)
...
Set Rs
...
VbEdit(“text2”)
...
Fields(“v2”)
VbWindow(“Form1”)
...
Click
VbWindow(“Form1”)
...
Click
VbWindow(“Form1”)
...
Click
VbWindow(“Form1”)
...
Click
VbWindow(“Form1”)
...
Click
Rs
...
Value(“Keys”,1)
Select Case Res
Case “K1”
Call login()
16

Call insertorder()
Call openorder()
Call logout()
Case “K2”
Call login()
Call insertorder()
Call logout()
Case “K3”
Call login()
Call openorder()
Call logout()
Case “K4”
Call login()
Call logout()
End Select
18/8/2013

Working with Flat Files:
1
...

NOTE:
OpenTextFile method: This method is used to opening an existing text file
...
OpenTextFile “path of the txt file”
(1= read, 2=write)
ReadAll method: To read the complete data from the text file
...
FileSystemObject”)
Set F1= Fso
...
txt”,1)
Msgbox ReadAll
2
...

NOTE:
CreateTextFile method: This method is used to creating a text file to a specific location
...
CreateTextFile(“txt file location”)
WriteLine method: This method is used to write the data line by line
...

WriteBlankLines method: This method is used to write the blank lines
...
FileSystemObject”)
Set F1 = Fso
...
txt”,2)
F1
...
WriteBlankLines(10)
F1
...
WriteLine(“Welcome to India”)
a)Do the parameterization for flight reservation window through scripting (If the customer is provided
the data in the flat file)
Step1: Prepare the test data in the following name
...

Dim Fso,F,F1,arr
Set Fso = CreateObject(“Scripting
...
OpenTextFile(“d:\testdata
...
SkipLine
Do While not F1
...
ReadLine
arr = split(arr,”@”)
Window(“Flight Reservation”)
...
WinObject(“Date of Flight:”)
...
WinComboBox(“Fly From:”)
...
WinComboBox(“Fly To:”)
...
WinButton(“Flight”)
...
Dialog(“Flight Table”)
...
Click
Window(“Flight Reservation”)
...
WinEdit(“Name:”)
...
WinButton(“Insert Order”)
...
Activate
Window(“Flight Reservation”)
...
Click
Loop
B)Capture the order number and write into an text file
...
FileSystemObject”)
19

Set F1 = Fso
...
Txt”,1)
Set F = Fso
...
txt”,2)
F1
...
At End Of Stream = true
arr = F1
...
Activate
Window(“Flight Reservation”)
...
Type arr(0)
Window(“Flight Reservation”)
...
Select arr(1)
Window(“Flight Reservation”)
...
Select arr(2)
Window(“Flight Reservation”)
...
Click
Window(“Flight Reservation”)
...
WinButton(“OK”)
...
Activate
Window(“Flight Reservation”)
...
Set arr(3)
Window(“Flight Reservation”)
...
Click
Wait(10)
Output = Window(“Flight Reservation”)
...
GetROProperty(“text”)
F
...
Activate
Window(“Flight Reservation”)
...
Click
Loop
19/8/2013

FrameWork: It is generis work(set of generic guidelines) designed by an expert and used by many people
to accomplish a task in an effective,efficient and optimized way
...

2
...

4
...


Line Frame Work
...

Keyword Driven Frame Work
...

Batch Frame Work
...
Test Data
...
Repository
...
Library
...
Recovery
...
Environment
...
Test
...
Log
...

Create required shared repositories and save them in corresponding folder
...

Create the required Recovery files and save them in corresponding folder
...

Associate all the required resources
...

 Save the test in the corresponding folder and open it whenever we required
...

 Finally analyze the result
...
Create an excel file, enter some data and save it
...
Applications”)
Excel
...
Workbooks
...
Cells(1,1)
...
Cells(5,5)
...
SaveAs “d:\roopa
...
close
Excel
...
Reading values from a specific Excel Sheet
...
Applications”)
Excel
...
Workbooks
...
xls”)
Set WorkSheet1 = Excel
...
Item(“Sheet2”)
Msgbox WorkSheet1
...
Value
Msgbox WorkSheet1
...
Value
WorkBook
...
Quit
NOTE:
Workbooks
...

Syntax: WorkBooks
...
Item Method: It is used to focus on a specific escel sheet from the application
...
Applications”)
Excel
...
Workbooks
...
xls”)
Set WorkSheet1 = Excel
...
Item(“Sheet2”)
WorkSheet1
...
Delete
WorkSheet1
...
Delete
WorkBook
...
xls”)
WorkBook
...
Quit
Adding and deleting a specific Excel Sheet:
Example:
Dim Excel,WorkBook,NewSheet,DelSheet
Set Excel = CreateObject(“Excel
...
visible = true
Set WorkBook = Excel
...
Open(“d:\123
...
Sheets
...
Name = “gvg”
Set DelSheet = WorkBook
...
Delete
21/8/2013

Scenario:

23

In a flight reservation window, select an item from fly_from combo box and verify whether that item
available or not in fly_to combo box, like this select all items one by one in fly_from combo box and verify
whether that item is available or not in fly_to combo
...
Activate
Window(“Flight Reservation”)
...
Type “121222”
icount1 = Window(“Flight Reservation”)
...
GetItemsCount()
Msbbox icount1
For I = 0 to icount1-1
Window(“Flight Reservation”)
...
Select(i)
ifrom= Window(“Flight Reservation”)
...
GetROProperty(“text”)
icount2 = Window(“Flight Reservation”)
...
GetItemsCount()
msgbox icount2
for j = 0 to icount2-1
Window(“Flight Reservation”)
...
Select(j)
ito= Window(“Flight Reservation”)
...
GetROProperty(“text”)
msgbox ito
If ifrom <> ito Then
Msgbox “test passed”
Else
Msgbox “test failed”
End if
Next
Next
23/8/2013

Modular FrameWork or Functional frame Decomposition:
24

1
...

3
...

5
...

Make them as reusable components
...

Execute the Drivers
...


Actions: Action is a set of instructions to perform a specific task
...
Normal Actions
...
Reusable Actions
...

NOTE2: External Actions are Non-Editable
...

2
...

4
...

6
...

Splitting an Action
...

Renaming an Action
...

Deleting an Action
...
Inserting a New Action:





Activate the menu item insert
...

Specify the Action name
...


3
...

Activate the menu item edit
...

Select the action properties
...

Specify the Action name
...

25

4
...

Activate the menu item edit
...

Specify the new action name
...


6
...

 Edit menu,action and delete action
...


Advantage:
Fast execution
...


Example:
Dialog(“text:=Login”,”x=375”,)
...
WinEdit(“attached text:=AgentName:”)
...
WinEdit(“attached text:=Password:”)
...
WinButton(“text:=OK”)
...
Close
5/9/2013
Exporting data from a database to textfile:
Dim Con,Rs,Fso,MyFile,r1,r2
Set Co = CreateObject(“ADODB
...
RecordSet”)
Set Fso = CreateObject(“Scripting
...
CreateTextFile(“d:\res
...
Provider = “Microsoft
...
Oledb
...
0”
Con
...
mdb”
Rs
...
EOF
r1 = Rs
...
Fields(“pswd”)
Myfile
...
MoveNext
Loop
7/9/2013

Recording Modes:
There are 3 types of recording modes
...
Context/Normal recording mode
...
Analog recording mode
...
Low Level recording mode
...
Normal Recording mode: It is used for recording the performed on a standard GUI objects In different
situatuins
...
Analog Recording mode: It is used for drawing and signatures
...
Low Level recording mode: It is a special recording mode provided by QTP, which is used for recording
atleast some operations on the non-supported environment also
...

13/9/2013

27

Virtual Object Configuration: It is not a real object, but it will work like real object
...


Virtual Object Manager: It is used for storing the virtual object information and also provides a provision
to delete unnecessary virtual objects
...

Tools, virtual objects
...

The virtual object manager wizard will be opened
...

Select the object type
...

Select the area with the help of mark object
...

Select the parent hierarchy
...

Specify the name of the button
...


Regular Expressions: Whenever the object value is changing dynamically, then we will go for regular
expressions
...
Dialog(“FaxOrderNo
...
Type “1111111111”
Window(“Flight Reservation:”)
...
*”)
WinButton(“send”)
...
Activate

17/9/2013
28

Tips for generating the basic script for web based applications
...

NOTE:
Child objects: This method is used to capture the classname for specific object
...

ObjectCount: To count the number of specific objects
...
FileSystemObject”)
Set Myfile = Fso
...
txt”,2)
Myfile
...
WriteLine “*******”
Set Odesc = description
...
Value = “link”
Set lists = Browser(“Google”)
...
ChildObjects(Odesc)
Nlinks = lists
...
GetROProperty(“text”)
Myfile
...

Dim nbutton,buttons,tbuttons,mybuttons
Set nbutton = Description
...
Value = “WinEdit”
Set buttons = Dialog(“Login”)
...
Count
Msgbox tbuttons
For I = 0 to tbuttons-1
Mybuttons = buttons(i)
...
FileSystemObject”)
Set myfile = Fso
...
txt”,2)
myfile
...
WriteLine “*********”
30

Set nbutton = Description
...
Value = “WinEdit”
Set buttons = Dialog(“Login”)
...
Count
Msgbox tbuttons
For i = 0 to tbuttons-1
mybuttons = buttons(i)
...
WriteLine mybuttons
Next
2/10/2013
Input and Output Parameters:
VbWindow(“Form1”)
...
Set parameter(“v1”)
VbWindow(“Form1”)
...
Set parameter(“v2”)
VbWindow(“Form1”)
...
Click
res1 = VbWindow(“Form1”)
...
GetROProperty(“text”)
parameter(“a”) = res1
VbWindow(“Form1”)
...
Click
res2 = VbWindow(“Form1”)
...
GetROProperty(“text”)
parameter(“b”) = res2
VbWindow(“Form1”)
...
Click
res3 = VbWindow(“Form1”)
...
GetROProperty(“text”)
parameter(“c”) = res3
Navigation:
1
...

31

2
...
in the flight reservation window and check whether the order is
accepting only numerical values or not
...
Activate
Window(“Flight Reservation”)
...
Select “File;Open Order…”
Window(“Flight Reservation”)
...
WinCheckbox(“orderno
...
Dialog(“Openorder”)
...
Set “Nellore”
ord = Window(“Flight Reservation”)
...
WinEdit(“Edit”)
...

Scenario: Open the QTP and open a new test
Dim qtApp
Set qtApp = CreateObject(“QuickTest
...
Launched <> True then
qtApp
...
Visible = true
qtApp
...
Application”)
If qtApp
...
Launch
End if
qtApp
...
New
qtApp
...
WindowState = “minimized”
*Start the QTP, opening an existing test
...
Application”)
If qtApp
...
Launch
End if
qtApp
...
New
qtApp
...
WindowState = “minimized”
qtApp
...
Encrypt method: It is a utility object provided by QTP, which is used for generating the
encrypted password
...
Encrypt(pass)
---> Using password encoder: This is the tool provided by QTP, to encode the password
...
Many of
the cases, the automation script would be maintained by multiple people or by multiple team members
...

Important VbScript functions:
1
...

Example: DimVal
Val = abs(-50
...
Left Function: It returns the left side characters from the original string
...
Right Function: It returns the right side characters from the string
...
Len Function: It returns the number of characters in a string
...
Time Function: It returns the current system time
...
Join Function: It returns a string created by joining a number of strings, contained in an array
...
Hour Function: It returns the number between 0 and 23, representing the hour of the day
...
Now Function: It returns the current system date and time
...
Asc Function: It returns the ANSI characters from a letter
...
Inputbox Function: It displays the prompt in a dialog box for providing the input values from the
user
...
ReportEvent: This is a utility object provided by QTP, which is used for generating the user
defined result in the result window
...

Condition2: If its starts with 9440 or 9441, then it displays mobile number
...

Example:
Dim Val, Val_length, Val_Numeric, Val_Series, Val_Start
Val = Inputbox(“enter the mobile number:”)
Val_length = Len(Val)
Val_Numeric = IsNumeric(Val)
Val_Starts = Left(Val,1)
Val_Series = Left(Val,4)
If Val_length = 10 and Val_Starts = 9 Then
If Val_Series = 9866 or Val_Series = 9866 Then
Msgbox “It is a airtel number”
Else If Val_Series = 9440 or Val_Series = 9441 Then

36

Msgbox “It is a BSNL number”
End If
End If
End If
5/10/2013

*Write a program to find out whether the given number is even or odd
...

Dim num1,num2,tot
num1 = inputbox(“enter num1 value:”)
num2 = inputbox(“enter num2 value:”)
tot = cdbl(num1)+cdbl(num2)
msgbox tot
{cdbl = convert to double}
{cint = convert string to integer}

*Read four subject marks and calculate the total and grade
...

Condition2: If average marks are >=60 and <75 then grade is first class
...

Condition4: If average marks >=40 and <50 then grade is third class
...

Dim sqtp,slr,sqc,ssql,tot
sqtp = inputbox(“enter qtp marks:”)
slr = inputbox(“enter loadrunner marks:”)
sqc = inputbox(“enter quality center marks:”)
ssql = inputbox(“enter sql marks:”)
tot = cint(sqtp)+cint(slr)+cint(sqc)+cint(ssql)
Msgbox tot
If cdbl(sqtp)>=40 and cdbl(slr)>=40 and cdbl(ssql)>=40 and cdbl(sqc)>=40 and cdbl(tot)>= 300 Then
Msgbox “grade is distinction”
Else if cdbl(tot)>=240 and cdbl(tot)<300 then
Msgbox “grade is first class”)
Else if cdbl(tot)>=200 and cdbl(tot)<240 then
Msgbox “grade is second class”
Else if cdbl(tot)>=160 and cdbl(tot)<200 then
Msgbox “grade is third class”
Else msgbox “grade is fail”
End If

*Display the natural numbers upto ‘n’ and capture the result into an text file
...
FileSystemObject”)
set myfile = fso
...
txt”,2)
myfile
...

Dim fso,num,n,myfile
n = inputbox(“enter the value:”)
num = 1
For num = 1 to n step-1
set fso = CreateObject(“Scripting
...
OpenTextFile(“d:\123
...
WriteLine num
Next
10/10/2013

*In a google web page get the collection of child objects of object class
...

1
...
inner text
3
...
Create()
desobj(“micclass”)
...
Page(“IRCTC Online Passenger”)
...
count
msgbox objcount
Datatable
...
ImportSheet “D:\roopa1
...
Getsheet(3)
For I = 0 to objcount-1
Datatable
...
Value(“html tag”,3)= objcoll(i)
...
Value(“innertext”,3)= objcoll(i)
...
Value(“href”,3)= objcoll(i)
...
Value
...
xls”,3
11/10/2013

*Invoke the QTP, opening an existing test, associate all the object repositories and save
the text using automation object model (AOM)
...
Application”)
If qtapp
...
Launch
End If
qtapp
...
Open “C:\Documents and settings\Admin\Desktop\Login”,False
Set qtrepositories = qtapp
...
Actions(“Action1”)
...
Find (“C:\Documents and settings\Admin\Desktop\Login
...
Add “C:\Documents and settings\Admin\Desktop\Login
...
Test
...
Test
...
Quit
Static method: This method is used to capture the static property from the application
...
Activate
Dialog(“Login”)
...
Click
imsg = Dialog(“Login”)
...
Static(“The password is
‘MERCURY’”)
...

Default method for menu option is “select”
Example:
*From a notepad get the menu list names and get the menu item names from the menu
1
...

Dim cnt,n,ipath
Cnt = Window(“Notepad”)
...
GetItemProperty(“”,”SubMenuCount”)
For n = 1 to cnt
41

Ipath = Window(“Notepad”)
...
BuildMenuPath(itempath,n)
Msgbox ipath
Msgbox Window(“Notepad”)
...
GetItemProperty(ipath,”Label”)
Next
2
...
WinMenu(“Menu”)
...
WinMenu(“Menu”)
...
WinMenu(“Menu”)
...

Dim iexcel,objdesc,objcall,sname,isheet,iworkbook
Set iexcel = CreateObject(“Excel
...
ActiveWorkbook
iexcel
...
Workbooks
...
ActiveSheet
Set objdesc = Description
...
Value = “Link”
Set objcoll = Browser(“IRCTC Online Passenger”)
...
ChildObjects(objdesc)
42

Msgbox objcoll
...
count-1
sname = objcoll(i)
...
Cells(i+1,1) = sname
Wait(5)
Next
Set iworkbook = iexcel
...
SaveAs “D:\IRCTCLinks
...
Quit
29/10/2013

Transaction: It is a new concept provided by QTP 9
...
It can be
divided into 2 types
...
Start Transaction
...
End Transaction
...
StartTransaction “Transaction Name”
Statements to be executed
Services
...

NOTE: shortcut key F7

43


Title: Quick Test Professional Notes
Description: Quick Test Professional(QTP) is a automation testing process used in computer industry. This is the notes given by me to the students. It covers entire subject and all the programs given in this book are executed