You are on page 1of 128

;Mx: liveTech

twdt;7~s~

r:

I'!
\j

Course Material

'1.1

I .

.,

'

,.

'

i-

.~r'L___

j::,_
~

[
1. _

~-----

i:
g___

l;

\l

t!;

I~

r-~

~~

~~===
~ r -

.~ r -

Ib:

Live Tech
Since 2004, LiveTech is involved in training on Software Testing Tools Projects for over 8
years. It was established with a motive to promote software testing practice and competency by
providing training to aspirants seeking career in software testing. It is the first Institute of its kind
that started Project Testing in Hyderabad. Since 2004 LiveTech has successfully skilled 50000+
professionals in Software Testing.

i
I

'f--

LiveTech is a leader in creating not only skilled professionals but also enhance their
employability through real time project implementation training in Software Testing. The
programs are designed by industry experts and backed by certifications recognized globally.

Mr. Venkataramana Reddy- Faculty


Currently working as a Sr. Test Manager with SEI CMMI Level 5 Company and having 12+
Years of Genuine experience in Software Testing. Mr.Venkat handled 300+ batches and trained
40,000+ Professionals from last 8 Yrs in LiveTech.The very first faculty to start of its kind
Project Testing in Hyderabad. He is Founder and Director of LiveTech.

Testing Tools with Project


(Functional Test Engineer Program)

Module 1:
Module 2:
Module 3:
Module 4:

Software Engineer Foundation Program


Real Time Manual Testing - Test Design
Testing Environment - URL
Project Testing- Test Execution

Software Engineer Foundation Program


Module 1:
1.
Introduction to Software Testing
2.
SDLC phases and Deliverables
3.
SDLC Models
4.
Software Engineering
5.
Software Process and benefits
6.
SEI CMMI Levels
7.
Software Configuration Managemen:- VSS
8.
SQA and SQC and Verification and Validation
9.
Testing Roles and Responsilities
i_"_

Module 2:
Real Time Manual Testing (Test Design)
1.
Project Management Plan
2.
Requirement Specifications
3.
Test Plan
4.
Test Scenarios
5.
Test Cases
6.
Checklist for; Web application testing

Mr.Venkat (Sr. Test Manager)

Page 1 of 118

,-.-

L-

~LiveTech

6!'tfyttstiiJOS<JfBri<>DJ

Module 3: Testing Environment (URLl


Project and Product
1.
MVC Architectures
2.
Environments and Servers
3.
Project Architecture
4.

'""'

L
I

Project Testing (Test Execution)


Module 4:
Builds from Development to Testing
1.
Text cases Execution
2.
Defect Reporting
3.
Working with Track+ I Bugzilla
4.
Severity and Priority
5.
Defect life cycle
6.
Re-testing and Regression testing
7.
Project Workflow
8.
Requirements Traceability Matrix
9.
Testing Process
10.
Database Testing using Toad
11.
Automation using HP QTP
12.
Automation Frameworks Implementation
13.
1. Linear Framework
2. Modular Framework
3. Data Driven Framework
4. Keyword Driven Framework
5. Hybrid Framework
Test Management using HP Quality Center
14.
1. Site Administrator Job
2. Quality Center Users Job

J
r
I
~

~
~

~
~~

"~

__

...

l.i

~1
";

Mr.Venkat (Sr. Test Manager)

Page 2 of 118

Automation Testing Process


In my current project Automation Testing Process started with three Stages

1. Tool Evaluation
2.
3.
4.
5.
6.

Analyzing the Test cases


Preparing Analysis sheet
Estimating script development time
Sending summary sheet for Approval
Confirmation

7. Automation Folder Structure Preparing


8. Preparing Object Repository
9. Creating re-usable components and functions
10. Creating scripts and Enhancing scripts
11. Dry run
12. Final Execution
13. Peer Execution
14. Delivery of scripts
15. Enhancements

-Stage 1

-Stage 2

I
-Stage 3

;_:.._

,-.-

,-,-

Mr.Venkat (Sr. Test Manager)

Page 3 of 118

a .

~
fi

For developing Automation Scripts and framework we need to know below Concepts:
I. Retesting and Regression testing
2. Test Automation fundamentals
3. Automation Testing Tools
4. Recording and Run modes
5. Object Oriented Programming
> Object Repository
- (Folder I)
6. Descriptive Programming
7. Synchronization
8. VB Script
> Conditional Statements
> Built-In functions
-(Folder 2)
> User defined functions
> QTP Sample Script with Template
9. Data Driven Testing- Parameterization
-(Folder 3)
I. Data Table
-(Folder 4)
2. Environment
3. Random Number
4. Data base
5. Text files
6. Excel files
I 0. Actions
11. Checkpoints
12. Recovery Scenarios
-(Folder 5)
13. QuickTest Script Editor
14. Test Batch Runner
15. Automation Object Model (AOM)
-(Folder 6)
16. Web Programming (Web Scripts Development)
-(Folder 7)
17. Test Results and Test Log
-(Folder 8)
18. Automation Frameworks Implementation
I. Linear Framework
2. Modular Framework
3. Data Driven Framework
4. Keyword Driven Framework
5. Hybrid Framework
19. HP Quality Center- Test Management
1. Site Administrator Job
2. Quality Center Users Job

1--

,,

-~-

.,

51 ~~:a e-t:P~~e
D Environment
f!Jl Library
~::;;3 Recovery
~ Repository

~3 Test Dat-3

ell TestLoQ .
20. Others

~Test.Run
tes~ script:

fi:i:ll

-"- -

Mr.Venkat (Sr. Test Manager)

Page 4 of 118

.* Livelech

Brdj ltstinn scfntio.,

1. Retesting and Regression testing


What is Retesting?
Retesting of the application to verify whether defects have been fixed or not.
What is Regression testing?
1. It is Re=Execution of some or all test cases of a testing activity for each build to verify
that changes or fixes made have not introduced new errors
2. Regression testing is done in three situations.
1. One is after fixing the bug
2. Second one is if a new change request will come from client.
3. Third one is when Environment changes
Here we have to verify whether already existing functionality can getting defects (or) not.
What is "Automated Testing''?
"Automated Testing" is automating the manual testing process currently in use.
This requires that a formalized "Manual Testing process" currently exists in your
company.
Minimally, such a process includes:
!i
Detailed test cases, including predictable "expected results". (Test Cases must be
documented)

Ij
l

II
1
I

A standalone Test Environment, including a Test Database, such that the test cases are
able to be repeated each time there are modifications made to the application.
If your current testing process does not include the above points, you are never going to be able
to make any Effective use of an automated test tool.
> The real use and purpose of automated test tools is to automate regression testing.
> This means that you must have or must develop a database of detailed test cases that are
repeatable, and this suite of tests is run every time there is a change to the application to
ensure that the change does not produce unintended consequences (errors).
r An "automated test script" is a program.
> Automated Script development, to be effective, must be subject to the same rules and
standards that are applied to software development.
'r An "automated test Suite" is a database of all detailed Automation Test Cases.
\Vhy we go for Automation?
Probfems in Manual Testing
,- No Reusability
,- More Resources required
> Time con~uming
;.- Budget is high
> Human Errors causes poor quality
> Simultaneous actions are not possible (Parallel)
\Vhat is Automation Testing?

~---

r Tes1ing an application with third Party Software help or Automation Tool is called

>

Automation Testing.
(or)
Comerting manual Test cases into Automation Scripts (in form of code) is called
Automation Testing.

Mr.Venkat (Sr. Test Manager)

Page 5 of 118

----

--

Benefits of Automation Testing


> Reusable
> Quality
> Fast
> Reliable
> Repeatable
Automated functional testing tools
1. Open Source (FREE Tools)
> Selenium
> Badboy
> Sahi
> Watir
2. Commercial
> HP QTP
> IBM Test partner
> Empirix eTest Suite

J--

Tool Evaluation
In my current project, Automation tool is evaluated based on below project features:
1. Multiple Browser Support
2. Java applications support
3. Ease ofUse
4. Multiple Operating Systems
5. Ajax support
6. Web Applications support
7. UI Tests
8. Scripting
9. Record and Play back
10. Object recognition capability
11. Data driven testing
12. Customization of recorded code as per our requirements
13. Synchronization issues
.14. Test suite creation
15. Ivlaintenance of scripts when features modified
16. Central Object Repository
17. APls availability
18. Database verification
19. Vend or support
20. Frameworks Creation
21. Tool Performance

r--

Based on initial evaluation on above Project scenarios, the above information is captured.
QTP and Selenium tools are finalized after evaluation other tools from both commercial and
open source.
Client/Management is finalized QTP Tool to automate my Current Project.

Mr.Venkat (Sr. Test Manager)

Page 6 of 118

'

~-

~
w

Introduction to HP QTP
~
~
~
~
~

Initially developed by Mercury Interactive Corporation


Mercury Interactive is acquired by HP (Hewlett-Packard)
HP Commercial Product
Functional Testing Tool
Used for Regression Testing
A vail able in various versions like
11.0- Released in 2010
10.0 - Released in 2009
9.5 - Released in 2008
9.2- Released in 2007
9.0- Released in 2006
8.2 - Released in 2005
8.0- Released in 2004
7.0- Never released.
6.5 - Released in 2003
6.0 -Released in 2002
5.5 - First release. Released in 2001
It supports Functional Testing of all popular environments, including Windows, Web, .Net,
Visual Basic, ActiveX, Java, SAP, Siebel, Oracle Applications, PeopleSoft and Mainframe
Application Technologies
It supports 100% dynamic testing.

Introduction to Quick Test Process


Quick Test testing process consists of 7 main phases
1. Preparing to record
Test Environment
Test Conditions (Regression Test Cases)
2. Recording a session on your application
Navigate according to Test Conditions
Execute Regression Test Cases
3. Enhancing your test
Parameterization
Adding logic and conditional statements

Inserting checkpoints

4. Debugging your test


Check that it operates smoothly and without interruption.
5. Run Test
Check the behavior of your application
6. Analyzing the test results
7. Reporting defects using Tracking tool (Quality Center I 0.0/Bugzilla 3.2)

Mr.Venkat (Sr. Test Manager)

Page? ofll8

i~-

-* liveTech

fUctFj llSiig sofzltou

QTP - Licenses
Two types oflicenses
1. Seat License
-Single User
2. Concurrent License -Multiple Users
1. Seat License
A permanent seat license that is specific to the computer on which it is installed.
2. Concurrent License
A network-based concurrent license that can be used by multiple QuickTest users.
Add-in Manager

Default Add-ins
ActiveX
Visual Basic
Web
Available Add-ins
Java
.Net

SAP

etc: ..

Title bar
Menu bar
Toolbars
Document
tabs

Test Flow
pane
~<eyv~ord

View

Expert
View tab

Data Table - - - ; ! - - - - - - - - -

._-_

Mr.Venkat (Sr. Test Manager)

Page 8 of 118

r--

QTP Main window is divided into mainly 8 parts


1. Menu Bar
2. Toolbars
3. Test Flow Pane
4. Test Pane
4.1 Expert View
4.2 Keyword View
5. Data Table
6. Active Screen
7. Debug Viewer
8. Missing Resources Pane
1. Menu Bar
Displays menus of Quick Test commands.(File, Edit, View, Insert, Automation etc.,)
2. Toolbars
Displays Icons/images for all Quick Test commands or submenus
3. Test Flow Pane
Displays the hierarchy of actions and action calls in the current test, and shows the order in
which they are run.
4.0 Test Pane
4.1 Expert View:
In the Expert View, Quick Test displays each step as a VBScript line or statement.
1. Web Application
1.1 Object's description --- Displayed in parentheses and Case Sensitive.
Browser ("Google")
1.2 Object hierarchy---- Separated by a dot.

Ig-

Browser ("Google").Page ("Google").WebEdit("q")

il

Operation or method--- Always displayed at the end of the statement, followed


by any values associated with the operation.

~-------

1
i

Browser("Google").Page("Google").WebEdit("q").Set "Venkat"

2. Desktop I Windows Application


Dialog ("Login'').WinEdit("Agent Name:").Set "admin"
Window ("Flight Reservation"). WinButton("FLIGHT").click
4.2 Keyword View
In the Keyword View, Quick Test displays information about each step and shows the object
hierarch in an icon-based table.

"""'
;;;:iiii::-&rJi.i'
fC:;;;:;;:c-:

,c~l,;~~~,~s{~~fi:~;ttb~tfii~~ki%;0f:'(t;;;~~~s~2.rfi.~> 11:;;&r:+tii10\i?1'l'z.it1HA~~~1~!l~~;t~~~J:~t'11'%0frL~';ii.%it.'011~~; .

f+ii!~~F:;;;~:;~~~~$~1[~~;::::Ejil~::a~

i~Wl/g:~~]tl~~*~ii,;iiif~~~"@.-~.:~.'fF.jfki~.:~w&t~*4t~w;~;t~"R~f~Ji~ltitm"~J::~~(i~
:T>tpemicT~inlhe''Mask.EdBox"ActiveXobiecl

:rnicT.o:b

jType

1~?S:Jt~Jt~~tt"f:1{~i,i~~;;;&1f~\,,~,_;<-A~tw;rt~~-t:t:~--::~;,!~:~~~f~~~::!~:t~~~,:~~~~~:~\~~.1li~~tis
)Select

;Se&ectlhe '\.as Angeles:" item hom the "Fly TO:" bl

;t.osAngeSes"

-~-~~:1-~>:~:tt~i~ltt~~:~:~::r~~ftfit~~~4t:r -~i',~\~~+lm~;~~-~-~i~l&~ift~~:tt~=~-~~~1/i~ttqf;tv;~}:r~m~~-?&l~JB::\:
Click

; Set

:"mefcu-y"

<.'r}~-::mt1fl~(~{tf-~:~f:;~}1S~;~J}?.k~i'i
Chck

'

; C'cl< the "FUGHT" WI on

1-~ttft.Y:"S)idf~:~2;i;Jfnilt~~~%i~hit~~t\~~f~?~:i;;;._-_ ,:<-~;1J0ilf\~~s~;1SJ>~t:&;~;.~,;;:~;2Zi}k~it~;~i ~~!;:_,


i Erl:er ''mere...y" ~the ''N.ome:" edit box.
Chck the "ln~erl Order" butron

:;-

Mr.Venkat (Sr. Test Manager)

Page 9 of 118

~=--===-=
,
--- -

5. Data Table
} It is used to store the data and parameterize that data to the test script
} There are two Sheets by default. They are
(1) Global
(2) Action!
} In one data table we will have 256 Sheets. Out of 256 sheets, one sheet is Global and
remaining 255 sheets are Action Sheets
} Global Sheet related to all the tests.
} . Action Sheet related to co~-~~p()pdin,.g; Acti()n OD,:ly~

:,,

; i;

t----

6. Active Screen
Provides a snapshot of your application as it appeare~ when you performed a certain step during
the recording session.
Advantages:
} Easy to insert Check Points I Output values.
} Easy to add objects to all object repository.
} Easy to insert steps.
} Easy to understand script by observing images in active screen area.
7. Debug Viewer
} It is used for viewing, modifying or setting the current values of variables or objects during
Test execution break with the help of three tabs--- Watch, Variables and Command
8. Missing Resources Pane
} Whenever we open a test, the files which are associated with that test are missed I moved then
Missing Resources Pane will be opened automatically and displays the information about that
missed file.
} The Missing Resources pane may list any of the following types of missing resources:
Missing Action Name
~vfissing Object Repository
. Repository Parameters
Missing Environment Variable
Missing Library

Unmapped parameter values


From test: C:\Prograrn FileslMercury lnteractive\QuickTest

~---

:=----=--:----

Mr.Venkat (Sr. Test Manager)

Page 10 of 118

'-

Object Oriented Programming


Class:

>>>-

A class is a blueprint or prototype from which objects are created.


It's an abstract idea of something.
Class contains data members and member functions.

~----

Object:

>-

Object is an instance of a class.


Example:
> Here person is a class which contains various attributes like Name, age, color, gender, height etc.,
> Each object contains their own values for abcve attributes.
> Objects are a representation of every item found in an application
> Objects (e.g. Button, Textbox) are elements within an application.
>- Each object has the following elements
Properties, Methods & Events
> Objects are referenced in code using dot notation
objectName.Method()
1. Properties
> These are characteristics of the object
Ex: the text on a button. QTP uses this to recognize the object
2. Methods
> These are built in functionality of the object.
> The VB Script code that we write (or record) actually makes calls to the methods of an object
Ex:
Reporter.ReportEvent()
Here ReportEvent is the method of the Reporter object.

3. Events
> These are what can be done to an object. This is used by programmers to determine what an
object does in response to an action you perform. It is however unused in QTP.

Understanding QTP Script


Windows EnVIronment Classes and Objects

Window I Obiect

Class/Script

Main Window

Window("Window Name")

Sub Window

Dialog ("Dialog Name")

S.No

3
4

5
6

WinEdit("EditBox Name")
ro.
vOffib 0 B OX

:3:

jcombol
, ...............
.

. Menu
Radio Button " ~;~ Button

WinComboBox("ComboBox Name")
WinMenu("Menu")
WinRadioButton("Radio Button Name")

WinCheckBox("Check Box Name")

WinButton("Button Name")

Mr.Venkat (Sr. Test Manager)

E-

Page 11 of 118

'

~
~

Web Environment Classes and Objects


Web I Ob.iect

S.No

Class/Script

!Browser

Browser("Browser Name")

Page

Page ("Page Name")

Frame

Frame("Frame Name")

wink

Link("Link Name")

~dit Box

WebEdit("EditBox Name")

!List Box

WebList("List Box Name")

Menu

WebMenu("Menu")

Radio Button

WebRadioButton("Radio Button Name")

9
10

CheckBox

WebCheckBox("Check Box Name")

Button

WebButton("Button Name")

Operation and Scripts


S.No

Script

Operations

!Active Window

.Activate

~nter Text in Edit Box

.Set "Text"

Select Item from the List box

.Select "Item Name"

Select item from the Menu

.Select "Menu Name;Item Name"

Check on or off the Radio Button./

.Set

Check on or off the Check Box

.Set "On/Off'

Press on Push Button

.Click

Enter Password in Edit Box

.SetSecure "Encrypted Text"

Close Desktop application

.Close

10

Close Web application

.Closealltabs

QTP Script Syntax


\

1. Windows Based
In which window.On what object.What operation is done.
Syntax:
Window("Window_Name").Object("Object_Name").Operation/Method.
2. WebBased
In which browser.in which page.on what object.what operntion is done. (or)
In which browser.in wl">..ich page.in w}ljch frame.on what 0bject.what operation is done.
Syntax:
Browser("Browser_Name").Page("Page_Name").Object( object_Name"). Operation/Method.

r----

Mr.Venkat (Sr. Test Manager)

Page 12 of 118

Q-.-

~
~

I==

E
Sample scripts for windows application
Test Scenario 1:
1. Activate window
,
. ,
2 Enter Agent Name as' admm1
Enter Password as "mercury"
Click on

, I

3:

Script

~-

-15'ialog("Login").Actlvate
,
. ,
Dialo "Login").WinEdit("Agent Name:").~;t adllli?, 1
D ..I g(("Login").WinEdit("Password:").Set mercury
Ia og

"OK") .Cl"lC k
Dialog("Login").WmButton(

Test Scenario 2:
1 Activate window
,
2. Enter Employee Name as "Appa Rao
3. Select Employee No. as EOOI
4: Enter Employee Salary as 10000
5. Click on [Submit]
.E~fl~-:~~:m.,,,

;=~rl
_
1;. ...:..=':,.-_. "'-__.___
><>
>
.s~_i'j'>

Script:
'

1-J ;ndoo.J (_\I Er11 pl~ ee o~/0

w;~do

( "

te.,r l~ee.

IJiV!J,w (" t:"'PI<?:Jee

tv'h bw

') . AcJi'vote..

~ ,.,.,e ,") sci ''.tr Pa /Ca o


Cc..thbc~
0-e:i-oJ't.s ':J ~v;~ L" t:...,l~ee No ::Fsek " E oa
oetru'l.s ':) IJ; n edo'l (_ " eropl ee

(" t=..pt~e veJ..,,ifs ':J,

"

tJ;.,u,'t (_ "&-plrq>e s.,J'?:Y :

J ..s-et

1--.-

Mr.Venkat (Sr. Test Manager)

Page 13 of 118

Test Scenario 3:
I. Activate Window.
2. Enter Patient Name as "Abc"
3. Select Ward No. as "I7"
. ,
4. Select Referral Doctor as "Dr.Armth
s. Select Cough Radio Button ON
6. Bill Check Box ON
7. Click on [Ok]
8. Enter X-Ray cost as "200"
9. Enter Blood Test as "300"
I o. Enter Bed Bill as "500"
Il. Click on

...!
'

X-Ray.

Blood Test

BedBill:

'
'
''
I

Ok

Test Scenario 4:

it--

'

Click on [Ok]

Script:

u;nd.,._, ( '' Ml mp t

E-

:;J oicc!~ ( ''.s~ mpLE- -t

').

D,'a.J.~J ( "

.s A-mpl <" - <. :)

:=-------=--=-----

Mr.Venkat (Sr. Test Manager)

Page 14 of 11 8

r---

L__

~. l-JVeTech

fil'tryUslilgs.kti.Ja

Sam~le scripts for a web application


Test Scenario 1:
1.
2
3:
4.
5.
6.

Open LiveHRMS stte"


"
Enter Login Name as rahul
Enter Password as "rahul"
Click on [Login] ,
Click on 'Logout
Close browser

Script:

s~ s~ cth' I ~4_)}

\\

r., Y<WMx ( ' Li ll't H ~ M.S -

,exp lure~

HUVJCUJ

!I

http: II

(,\JWW.

Lt o- ftC .

, /

(0'

j. p "'jE ( " Lo've Hr<. "lS -

R-e.> un e

I/'

h 'IY)S

li vo. "

iJ

l1a.t <>m:t

Nf!ht:d-'.'t( 11 txruS'/N"o.J"fle ' 1)s-u:: n~l

,,

t"/

- iNe.b t-d..lt (_ l l f >d:Po.dSWc-Yd.

,,
,,

J;

. ~I?Lt+-kn (1'

LV<[l'n

11J.

~c_l_c__

i'J. ~cl-' 1
~I',

I)

ut...k._ (_ l L LC[J

CLt

t- 11j C)..J 'c.)c._

I )

Test Scenario~: , .
f d . Login of current Project.
Verify Functionality o a mm
I. O~Y)

.2.

EfZPP'r0(_ +1-pp/.t'co.h'Cir) .

EWe.v CLtS+arrer

3 t'c.Jev fb$~Yd

4 clJcK
5

0!

U.serOV

tt

08

11

Pmc u

Pft1c 11

[ S\.t br..J t]

clic.l 0! , 1 G:L1

Prob~ t-e '


tl ~'ce_JJ
to cp~

-6 Sa.fe.d-

t:J pe_

oo

~ cJ..iu..

CYJ

Cstt!:A.ti:J

S c)_; c1<_

<11')

~ c.uJ

1 .

q c l o5'. M-e t3 rc.I..tll'-e,r


pmc.

If'J!::J

~--

l.\S0Jel

pa..s.su..l:ll:l
SllbN'.t-

Mr.Venkat (Sr. est Manager)

=
L---

L_

~ tivez,a.nl!~
sus+enJtth I

\\ exp lure~

I<Mh

ll

ht+p .'II LocJ ~cJJt

:...:!

. ~GOo I Er<.p
I_;
f \. f" fYJC ,3 0
t')

0~ ,f,Y = e n:o..xs.c.- l ,, p me.. Inc ''J' P~e (" Prnc 1


Sci oJ:u l)r I ~ i)~c.oJSe' [ "Pmc J" c "J P"':Je (''IJ-ew ~e
obJ Bv. !NebccLit ( H US'f'l rd__ 'j . sci II Pmc
Sci:

h(o ' )

::J

I)

objDr tuebt=c:Lt ( l'(J~swcl. 11 ) Sel:


6b.ifJr k.,e,b{3l{f+VYJ

'

''

t1b.i Br 1. F rcuv.-e (

Obi fJrt fyC41.o...e. (

i \

tr

11

S<.tl?rw't

C ru..~,c_

C.. Oe;_~'(s

.)'

PMc''

11

c_)_,'cl:_

;J rLJ ~<- (

lt

~cL.~ prCJlJ<'fe

~b~ s r l

'j

''

p~

{j . JJ'cJ.r;,__

f::-.j Pe ") .S~le c1


II

cb..18 n Fro-~v-.e ( \' e_ ~r.s ") ~ B!.i++crV} C \ '.s u1 ~- t: ~ . G0J<-.

abJ!n Fr~ (_ L~ c_n.k.t_


-~ ~"'u.-)sev
!

( \' Pmc rct c_.

'0 .

Lc.._t_ (

1'

L'ZJ

CJLtT

t:).

of. f.,(e

'I

d<&._

'~. CJ o..:;,e A-ll ro-bs

'i:: i!'

!: .
i

Test Scenario 3:
Verify Google Search.
Sl:J ,s.~ U

fi I iluY)

11

Nt.v W ;] O<(J le Cu'; ~

~-rCfuJ.s ('ljOcjle''.J Pc>je (_' 1 ~ Ooj Je

'

B-vo.;.\S 0- (_ n

4ofj 1-e 'j . Po:Je

bra..u.Je'fC 1 ~a~Jff
'

1---eAc~

~f.YV-))Er( '\ Cro~ re

) s~
t....!E.b e-ch't l 1'q; /)J.

l \' 0 CC:_il e ~~). ~% [)>j.}l-a7

J) (J~tl
1

11

fa

11 _).

Lue.IE'ch- G_ac(jte

L ,_{!_

T-e cJ,

c t.r
\I

!Jec-v~

cJ o J le
1

1
)

tr

Li ve._-,e-L.VJn t'.I
r

- b '_ J~
.s-e.a.~J... El}
/ GU
<...J'.......

D.u./c_

s~fJu.setrEj.. cL' vk_

8---1'

c l0 7l' Afl ~~

'

to...

~ -

Mr.Venkat (Sr. Test Manager)

Page16of118

18

~liveTech
Fivtly tulillll soflrtioos
Object Identification
How QTP learns objects in application?
Stores Object as Test Object, Determining the class it fits.
1. Mandatory properties
2. Assistive properties
3. Ordinal identifier
4. Smart Identification

1. Mandatory properties:
While recording, for each test object class, QTP learns a list of mandatory properties to Uniquely
identify the object.

2. Assistive properties:
If not sufficient, QTP adds assistive properties until is has compiled a unique description.

3. Ordinal identifier:

If no assistive properties are available or if not sufficient, QTP adds a special an ordinal
identifier types as index, location and creation time of the objects are used to create a unique
identification
'

4. Smart Identification:

If Quick Test is unable to find any object that matches the learned object description, or if it
finds more than one object that fits the description, then Quick Test ignores the learned
description, and uses the smart identification mechanism to try to identify the object.
A Smart Identification definition can help QuickTest identify an object, if it is present, even
when the recorded description fails due to changes in one or more property values

rr- -

Object Identification Dialog Box

Identification

I
f

'-.~
q

'

-c---li
[i

Mr.Venkat (Sr. Test Manager)

Page 17 ofll8

~llvelech
fivtfy W/iofl

..fiiiWos

Types of Objects
There are two types of object
Test Object:
}- Objects in Object Repository are Test Objects.
}- Test Objects are helps to QTP to identify and check the object during the run session.
Run-Time Objects:
}- Objects which are in Script are Run-Time Objects.
}- It is the actual object in your web site or application on which methods are performed
during the run session.

Object Repository
::

}- Interface between QTP Script and the application


}- Contains Logical Name and physical description of the objects
}- The Object Repository window displays a tree of all objects in the current action.

Navigation:

Name:
i(iii;i Agent Name:

:''

: mm Pa~sword:

Class:

Dialog

Repository:

1.-L-oca-.-,---------,_...;..;......._--.,_

fr

est objeci detaas

Comment

There are two types of Object Repositories:

1. Per action object repository:


Stores objects that are associated with one specific component [Action], so that only that
component can access the stored objects.
2. Shared object repository:
Stores objects that can be accessed by multiple components.

Mr.Venkat (Sr. Test Manager)

Page 18 of 118

t-r:

Object Repository Manager


~ The Object Repository Manager enables you to open multiple shared object repositories and

modify them as needed. You can open shared object repositories both from the file system.
,
Navigation:
Go to Resources Menu -7 Object Repository Manager

.. ~

1-

Nome

~~)i;j~j;\'~~"'@)-~j~~f:t~~i
nt~tivecloss

: SysListView32

Type.Vl!lue

;None

~,t~1~jj!~ti:~ ,:~~'.;~\Jit-~,G~tJ;~~41g;:~J;~~1t{t%~.
;:lM~~)~~~s ', ./~;,:J:(:~~b; ~;:~~;~:' :J,h:;;:')l~%-~i$:1~1
Enoble

Smorlldentificot...:~--

-..

Comment

Operations performed by Object Repositorv Manager


1. Creating New Object Repositories
2. Opening Object Repositories
3. Saving Object Repositories
4. Closing Object Repositories
5. Manipulating Objects in Shared Object Repositories
6. Managing Repository Parameters
7. Modifying Test Object Details
8. Locating Objects
9. Performing Merge Operations
10. Perfonning Import and Export Operations
Object Repository Comparison Tool
Navigation:Go to Resources Menu-70bject Repository Manager-70RM- Tools
Menu-70bjectRepository Comparison Tool

:~

,-~,_;

Object Repository Merge Tool


Navigation:
Go to Resources Menu-7 Object Repository Manager-70RM- Tools Menu-70bject
Repository Merge Too!

Mr.Venkat (Sr. Test Manager)

Page 19 of118

f--

,~--

Merge and associate Repositories


Navigation:
1. Generate Script for Project Login and Observe objects are stored in Object Repository.
2. Export and save the objects (ORl) of scriptl, using Object Repository (Go to Resources
menu and click Object repository. In Object repository go to File menu and click on 'Expor1
Local objects' and Save it into existing folder) and Save script 1.
3. Generate Script for Project Home Page and observe Objects are stored in Object Repository
4. Export and save the objects (OR2) of script2, using Object Repository and save Script2.
5. Go to QTP -7 Resources menu -7 Select Object repository manager
6. In ORM go to Tools menu click on Object repository Merge tool and Select Primary file as
OR 1 and Secondary File as OR2 and click on [Ok]
7. Save file as OR3
8. Associate OR3 into "Script 1 and Script2", while navigating to QTP Resources Menu and
click on associate repositories and add Repositories OR3 to Actionl and click on (Ok]
9. Run the scripts and observe results (Both scripts are used single repository-OR3)

(Or)
Second Best Method:
l. Object Repository creation for Project - while navigating to Object Repository and Add
Objects to Local
2. Export these repository into Local folder (Project\Object Repository)
3. Write manual scripts for Current project
4. Associate Repository to all Scripts, while navigating to Resources Menu and click on
associate repositories and add Repository
5. Run the scripts and observe results (All scripts are used single repository)

Mr.Venkat (Sr. Test Manager)

Page 20 of 118

~
f;

~liveTech

filefy ttstinn soltioDJ

Object Spy
1. It is used to view object properties and Operations.
2. Displays
);>
);>

Object hierarchy tree


Properties
Native Properties (Run Time properties)
Identification Properties (Test object Properties)

Operations
Native Operations (Run Time Operations)
Test object Operations
Navigation: Tools -7 Ob'ect
);>

t~

test objec1
hierarchy tree

ol>jecl type fil1er


object details tab

object proper1ies

selected prop.arty,

or operation

lOrt

QTP Script Generation and Execution Process


CD
as

18

Page 21 of118
Mr.Venkat (Sr. Test Manager)

~--~

1. Start Recording
}
2. Learn Object (Storing object in Object Repository)
3. Script Generation
4. Catch Entry in Object Repository
(Object Properties in Object Repository)
(match the properties in AUT)
5. Identify Object in AUT

During Recording

During RUN

AUT: Application Under Test

How to add objects in Object Repository

I
I

Navigation:
1. Resources~ Open. Object Repository~ Click on Add Object Icon~ Show Object with
Hand Icon ~ Click on [Ok]
2. Select Option [Select Object Only, Default Object Types, All Object Types, Selected Object
Types] . .
3. Click ori [OK]
4. Export these repository to Local Framework Folder
What is the extension ofthe Shared Repository?
.tsr (Test Shared Repository)

- - Ii

How to associate Shared Repository


There
1.
2.
3.

are three ways to add shared repository


Using Associate Repository
During Runtime
Using Action Properties

1. Using Associate Repository


" Go to Resources Menu ~ Associate Repository ~ Click on Add
" Select I Location of Repository file path~ Click Open
Associate with Action~ Click on [Ok].

_~:_
11
r-;

2'. During Runtime

repositoriescolJection.Add "Repository file path"


Ex: repositoriescollection.Add "F:\loginrep. tsr"
3. Using Action Properties
Right click on Expert View ~ Go to Action ~ Action Properties
Select "Associated Repositories" tab ~Click on Add~ Select I Location of Repository
file path
Click Open~ Click on [Ok]
Note:
ln QTP every action will have one local repository; apart from that local repository one can
associate more than one shared repository to the action.

Mr. Venkat (Sr. Test Manager)

Page 22 of 118

r)

Drawbacks of Object Repository:


~
~

It takes lot of time for identifying the object, when the object is changing dynamically during Run
time.
If the object Repository size increase then the execution speed will be decrease.

);;> To prepare script using object repository build is required

Descriptive Programming

Definition
~
~

~
1

Jject

I
.,,_

If we specify description of the object in the program it self that can be called as Descriptive
Programming.
Using Descriptive Programming we can execute test script without objects in Object Repository.
We can execute the test script without Object Repository.

I
I

Advantages:
~

~
~

Fast execution.
Easy to identify the objects.
We can prepare Script without having build.

Disadvantages:
~

""

It takes lot of time to design test Script -Time consuming for test script design

To design Descriptive Programming, there are two ways:


1. Specifying the properties and its values directly in the statement (script)
2. Description Object

1. Specifving the properties and its values directly in the statement (script)
Syntax I Code:
Browser ("PJ :=Value", "P2:=Value", .... ). Poge ("P1:=Value", "P2:=Value", .... ).Object.
("P1 :=Value". "P2:=Value", .... ).Operation I Method.
Example 1:
Prepare descriptive Programming for "Logir;t" Operation in Flight
Reservation
SystemUtil.Run "C:\Program Files\HP\QuickTest
Professiona1\samp1es\flight\app\tlight4a.exe"
. Di<llog("text:=Login").\VinEdit("attached text:=Agent Name:").Set "Venkat"
Dialog("text:=Login").\VinEdit("attached text:=Password:").Set "mercury"
Dialog("text:=Login").WinButton("text:=OK").Click
:11
Window("text:=Flight Reservation").Close
Example 2:
Prepare descriptive Programming for "admin login" Operation of project.
,-,-

ory

~an

118

Page 23 of 118

=
~~-

r .
f

nn

Example 3:
'Prepare Descriptive Programming for Google Search

Bravser (''

~cu-o< : "

BrwJ.sec('' ))c..,e;

"

I{ CkJ,Jie

':J Ft:5e L"btl~ : ~

1';, DdsJe

:)

0eb

~1:: (" ~c o/j


o

qCfJie 'j. P{J<:(" i'il:te : o 4oo:rJe ~~. ~ /,q lb, ( "~ . _

ll

L'Cte

:>c

l'eL~-J,

' - Cf ~le ~cYt.I:J


Cli'cJ:__

2. Description Object
To create Description Object we can follow below syntax.
Syntax I Code:
Set Object Name== Description.Create
Object Name ("Property Name"). Value= "Property Value"
Example 1:

Using description object, prepare descriptive Programming for "Login" Operation in


Flight Reservation
Set dia = description.Create
dia("text").value=="Login"
Set Ana = description.Create
Ana("attached text").value="Agent Name:"
Set pwd = description.Create
~ pwd("attached text").value="Password:"
Set but= description.Create
but("text'').value="OK"
Set WC==Description.Create
WC("text").value=="Flight Reservation"

S ystemutil.Run "Path of Exe"


dialog( dia).winEdit(Ana).Set "mercury"
dialog(dia).winEdit(pwd).Set "mercury"
dialog( dia).winbutton(but).Click
Window(WC).Close

Mr.Venkat (Sr. Test Manager)


Page 24 of 118

~liveTech

. FU.f; tmin "'""""

Example 2: Using description object, prepare descriptive Programming for "admin Login"
Operation of current project.

S 9!-

s.V:. r~

SjS~f.r 0.tn '1 le~pkv~/ uhttp :jj.j~

CX2.SC"I;ph{ly) . cr-fbJe.

bfO .:::=

::

go~; f"4>p(()C3 "a/';

0e3Cn'p-h'~ . c~

sci

Or)Q :::

sci-

pwd. -=

,.

8 r045& O:ov. P'tfe Ci'~ J. !-.bc-ott-(_ uh

D<ZSGrlpJ-ic() C'rWk
fy2,5Cn-plit?J. ~reJe.

V-

sel:: ~t- -= cesc npHcJ? ue::Je


se b--rot = oe.scr~'pl,(n. ctt'bte_
tl

:sel-

bmAc:K

I])J

r~. Ad_d ll.b_d:lt III upffX


UVJQ. .

Ad:L

( ( lr) c.JY) e_

(/

ll

.)

ll

'h::vr'x:

pmc r., C..

iJ

BrL-W~L breD p~ e LPGjJ

I0C.u

p /'Y) (_ L/

Nebhll#-cr] (_ ~t)
Lild:...

li(LS~d. If

~?_/,. pwd_. AJ_d_ L\ 71::Lv} t; \..\ fCJ..S56.X!rJ It


but, 1\d.d \\ Y)(;.me '/1 \( S CJh txJt- It

brol ttdd

l \ Y)GVnt' If
/

t\Ne_w ~

' I(

Example 3:Prepare Descriptive Programming for Google Search Using Description Object

Run Modes
Two Run modes
1. Nonnal- We can set timeout
2. Fast
Tools -> 0 ions -> Run
:-::

.c'

Genf!u.,l

T eMt A ecognilion
Folder$
Active S croen

li!IID

:-;

~eb
P.,g~/Ftcrn.,.

Run
Run modo

r-.

:.
Screen Capl....,re
Windo.....,s Applrc~crns
:
Adv.enced

i;

"

I'

Oelcy eoch step el<ecution by:

.-,-

-----------------------,

1-

Normal {displ.eys e1-<ecution marker)

miKiseconds

Fest

---- ....
Options

Advonced

1 : Allow other HP products to run tests and components


Stop comm.!'lnd .shortcvt keo,>'

Mr.Venkat (Sr. Test Manager)

Jctrl .. Alt

F5

Page 25 of 11 8

w - --

~- -

.*liveTech
!it-tlj Jtsling so{JJIJ~)D$

Synchronization

>-

>

When you run tests, your application may not always respond with the same speed.
For example, it might take a few seconds:
'
For a progress bar to reach I 00%.
For a status message to appear.
For a button to become enabled.
For a window or POP UP message to open.
You can handle these anticipated timing problems by synchronizing your test to ensure thn
QuickTest waits until your application is ready before performing a certain step.

I
' ''

Options to synchronize the tests


>- To give waiting time QTP there are three ways such as
I. Synchronization Point
2. Wait and Exist
3. Increase timeout

1. Synchronization Point

>

Instructs Quick Test to stop the test until the object property achieves the value you specify
(or until a specified timeout is exceeded).
> We can use this option to give waiting time to the tool based on specific object property
value.
Syntax:
Window("Window Name").Object("Object Name").WaitProperty "Property Name'', "Property
Value", Timeout in Milliseconds.
Web Application
> Browser ("Home Page").Page ("Home Page").WebButton("Submit"). WaitPrope11y
"visible", true, I 0000
Navigation:
1. Place the cursor in your required place of test script
2. Click on Start recording
3. Go to Insert Menu and click on Synchronization Point
4. Show object with Hand Icon and Click [Ok]
5. Select property Name (Enable) and Enter Property Value (True)
6. Set timeout in Milliseconds, Click [Ok] and Stop Recording.
Note:
1 Second= 1000 Milliseconds
~ While recording select Insert> Synchronization Point
S~lecting

the object

Adding Synchronization Point

-~-

I~

Mr.Venkat (Sr. Test Manager)

Page 26 of 11 8

2. Adding Exist and wait Statements


You can insert "Exist or Wait" statements that instruct QuickTest to wait until an object
exists or to wait a specified amount of time before continuing the test.
);;> You can use Exist and/or Wait statements in the expert view.
,
);;> Exist statement return a Boolean value indicating whether or not an object currently exists.
Example:
Browser("Home Page").Dialog("Message from Webpage").Exist
);;> Wait Statements instruct Quick Test to wait a specified amount of time before proceeding to
the next.
Example:
Wait(lO)
);;>

that

3. Increase timeout
);;>

>
);;>

The amount of time QuickTest waits for objects to appear or for a browser to navigate to a
specified page is insufficient, we can increase the default amount of time that QuickTest
waits for a Web page to load.
QTP maintain "20" Seconds as default object synchronization Time out.
Default time out is not sufficient, then we will increase Timeout in settings.

Navigation:
File Menu-> Settings-> Run Tab-> Change Object Synchronization time out-> Click on [Ok].

Transactions
:ny

Start Transaction & End Transaction


It is used to calculate the time taken to execute a block of statements or to estimate the speed of
processing.
Syntax:
Services.StartTransaction <"Transaction Name">
Statements
Services.EndTransaction <"Transaction Name">
Inserting Transactions
Choose Insert > Start transaction

:,;

t[!

Ending Transactions
Choose Insert > End Transaction

i: , -,_~----

Mr.Venkat (Sr. Test Manager)

Page 27 of 118

--------

--'1

..

~LiveTech
N'tfJ

IUiilrJI schtiau

VB Script
Purpose
When the tools provided by QTP are not sufficient to test an application, VBScript coding can b':
used.
~ VBScript was created as a web programming language by Microsoft and licensed by many companic;i
for use in their tools.
I. Checkpoints
-Check
2. Synchronization points
-Wait
3. Output values
- Retrieve information
4. Parameterization
- Data configuration
5. VBScript
-Adds programmable logic (For verifying Expected Result)
Last
option

Very powerful

What is VBScript?
~ It is a scripting language
~ It is a lightweight programming language
~ It is a light version of Microsoft's programming language Visual Basic
Diff b/w Programming and Scripting:
Programming

Scripting

I) Develop something from Scratch

I) Used to combine existing Components

~) SelfExecutable

2) Requires a Host

3) Compiled or Interpreted

3) Interpreted

!4) Complex

!4) Easy

VBScript Data Types


~ VBScript has only one data type called a Variant.
~ A Variant is a special kind of data type that can contain different kinds of information, depending on
, how it is used.
~ Sub-Types supported by Variant
1. Empty
6. Currency
2. Null
7. Long
3. Boolean
8. Double
4. Byte
9. Date (Time)
10. String
5. Integer
Variable Nami"ng Restrictions
~ A Variable is "Container" for information you want to store.
>- A variable's value can change during the script.
~ In VB Script, all variables are of type variant, which can store different types of data.
Rules for Variable Name:
> Must begin with an alphabetic character (Letter).
> Cannot contain a period(.).
~ Cannot exceed 255 characters.
> Must be unique in the scope in which it is declared.

Mr.Venkat (Sr. Test Manager)

Pnge 28 of 118

'~

~liveTech

firefy ltshnflSll{llti<'US

:an be

Declaring Variables
);> Variables can be declared by using Dim (or) Public (or) Private Statements.
);> Dim Statement - available to all procedures within the script.
);> Public Statement -available to all procedures in all scripts.
);> Private Statement - available only to the script in which they are declared.

'anies

Declaring Variables- Example


);> The dim declared before all functions, becomes a "global variable"
);> The dim declared within a function, acts as a "private variable"
Ex: dim a, b -7 a, b are variables scope with in the script/function.
function
-7
k is Private
dim k
end function
Scope and Lifetime of Variables
Procedure Level Scope:
When you declared a variable within a procedure, the variable can only be accessed within that
procedure. When the procedure exits, the variable scope is destroyed. These variables are called Local
variables. You can have local variables with in the same name in different procedures, because each is
recognized only by the procedure in which it is declared.
Script Level Scope:
If you declare a variable outside a procedure, all the procedures on you script can access it .The Life
time of these variable starts when they declared, and ends when the script is closed.
Best Practice for variables:
Option Explicit :
If we write Option Explicit, we must declare all variables (Force explicit variable declaration).
> Eliminate unnecessary creation of variables at runtime.
: ;. . It avoids variable typo mistakes.
> To avoid confusion in code where the scope of the variable is not clear.
on

e_ ______ _

-1

Should be the first statement of the script.


ex: Option explicit
Dim name
name= "John"

r.

i1
,-,::

VBSc'ript Constants
: ;. . Constants in VBScript can be created using the Const statement.
> Declares constants for use in place of literal values.
Example
Canst MyString = "This is my string."
Canst MyAge = 49

,_,1_

Array Variables
> Assign More than one value to a single variable. Can create a variable that can contain a series of
values called an array variable.

.-"

Declaration of Array variable uses Parentheses ()following the variable name.


Types of Array:
~:-

Mr.Venkat (Sr. Test Manager)

Page 29 of 118

f ---

1. Static Array: Size can be specified at the time of declaration


Ex: Dim Name(2)
II Number in parentheses is 2. Array contains the 3 elements start at ZERO.
Name(O) = "john"
Name(l) = "mery"
Name(2) = "moren"
II Retrieving value of array using the Index of the array
Dim arrayvalue
arrayvalue = Name(O)
2. Dynamic Array : Array size can be changed
Ex: Dim a()

Array starts with the index '0'


Ex : a[O] to a[5] for Array a(S)
The ReDim statement is used to size or resize a dynamic array that has already been formally
declared.
Redim a(lO)
VBScript Operators - Arithmetic Operators

'

:i

Description
Addition
Subtraction
String concatenation
Multiplication
Division
Exponentiation
Comparison Operators
Description
Equality
Inequality
Less than
Greater than
Less than or equal to
Greater than or equal to
Logical Operators
Description
Logical negation
Logical conjunction
Logical disjunction

Symbol

+
&

1\

Symbol

=
<>
<

>
<=
>=

Symbol
Not
And
Or

VBScript Input
InputBoxO:
It displays a dialog box containing a label, text box for entering data, (OK] and [Cancel]
Ex: a= lnputBox ("Enter the value")

Mr.Venkat (Sr. Test Manager)

Page 30 of 118

~liveTech
m'tfy

ltslifl wt.ti...

VBScript Output
MsgBoxO: It displays a dialog box containing a message and buttons.
Ex: MsgBox ("This is the value")
dim name
name= "John"
box" value of the variable name:" &name
[Jiiiii!!!ii!--

Conditional Statements
1. If Statement
~ If...Then ... Else statement
~ If...Then ... Eise If statement
~ Nested If statement
2. For...Next
~ For To ... Next
~ For each ... Next
3. While
~ While ... Wend
~ Do - Loop ... While
~ Do- Loop ... Until
4. Select Case statement
1. If Statement
You should use the if ... then .. Else .. Statement if you want to
~ Execute some code if a condition is true
~ Select one of two blocks of code to execute

Ex:
l.l

If... Then ... Else statement


IF Condition THEN
statements

ELSE
statements

-:~-

END IF

:J=-:~-

Ex:
i = InputBox ("Enter the value")
ifi < 10 then
MsgBox ("Good morning!")
else
MsgBox ("Have a nice day!")
end if

Mr.Venkat (Sr. Test Manager)

Page 31 of 118

1.21f... Then ... Eise If statement

IF Condition] THEN
statements
ELSEIF Condition2 THEN
statements
ELSE
statements
ENDIF
ENDIF
1.3 Nested If statement

..

IF Condition! THEN
IF Condition2 THEN
statements
else
statements
ENDIF
ENDIF

'

Ex:
i = InputBox("Enter the value")
ifi < 20 then
ifi < 10 then
MsgBox("Good morning!")
else
MsgBox ("Have a nice day!")
end if
end if
2. For ...Next
Uses a counter to run statements a specified number of times.
Repeats a group of statements a specified number of times.
2.1 For To ... Next
For counter= start To end [Step step}
[statements]

Next

,
__u,_ _

Ex 1:

Tota/=0
For i=O to 5 step 1
Total =total+]

riJ

";

Next

-~-

2.2 For each...Next


For each counter in variable
[statements]

Next

Mr.Venkat (Sr. Test Manager)

I
Page 32 of 118

Ex:
dim names(2)
names(O) ="Testing"
names(l) ="Java"
names(2) = "J2EE"
for each i in names
MsgBox(i)
next

3.Wbile
);>
);>

Loops while a condition is True.


Executes a series of statements as long as a given condition is True.

3.1. Wbile ... Wend


While condition
[statements]

Wend

Ex:
i=l
While i < 5
MsgBox(i)
i=i+ 1
Wend

3.2 Do - Loop ... While


);;> Loops while or until a condition is True.
);;> Repeats a block of statements while a condition is True or until a Condition becomes True.

Syntax:

Do
statement

Loop While condition

Ex:
i=l
Do
MsgBox(i)
i=i+l
Loop While i < 5

3.3 Do- Loop ... Until


Do
statement

Loop Until condition

Ex:
i=l
Do
MsgBox(i)
i=i+l
Loop Until i = 5

.-8

Page 33 of 118

Mr.Venkat (Sr. Test Manager)

4. Select Case statement

SELECT CASE variable


CASE "Value I"
statements I
CASE "Value2"
statements2
CASE Else
statements3

END SELECT

Ex:
I:

i == InputBox("Enter the value")


Select case i
case "A"
MsgBox("A ")
case "B"
MsgBox("B ")
case else
MsgBox("No")
End select

!:

-''-

Mr.Venk:at (Sr. Test Manager)


.

Page 34 of 118
:;,_

[___
t_ _
~

.* liveTech
fiNfyltstinO"'{Juim

VB Script Built-in Functions

(1)

II
II

Left

We can use this function to get a specified number of characters from the left side of a string.
Syntax: left (String, number)

Ex: x="sairam"
msgbox left(x,3)

2. Right

~
.

We can use this function to get a specified number of characters from the right side of a string.

\r

Syntax: right (String, number)


Ex: x="sairam"
msgbox right(x,3)

IC_,;~.... JI"

3.Len
We can use this function to find length of a string
Syntax: len (String)
Ex: x="sairam" msgbox len(x)

4.Mid

We can use this function to get a specified number of characters from the given string.
Syntax:

mid (String, Start Position, length)

Ex: x="$1245" msgbox mid(x,2,len(x)-1)

r:J_-j_
-----
'

Ex: x="Rs.14258/-" msgbox mid(x,4,len(x)-5)

5. LTrim

We can use this function to remove spaces from the left side of a string.

Syntax:
Ex: x="
msgbox ltrim(x)

ltrim (String)
Sai"

6. RTrim

We can use this :function to remove spaces from the right side of a string.
Syntax:
rtrim (String)
Ex: x="Sai
"
msgbox rtrim(x)

7. Trim

We can use this function to remove spaces from both the sides of a string.
Syntax:
trim (String)
Ex: x=" Sai
"
msgbox trim(x)

Page 35 of 118

18

Mr.Venkat (Sr. Test Manager)

~tlveTech
litfy

Us~Ult! scfuh'ons

8. UCase

~...

'..

We can use this function to convert Lower Case into Upper Case
Syntax:
ucase (String)
Ex: x="sairam" msgbox ucase(x)

.
.....

. .

... .

5AlR""'
.. .............. .. .
.

...

't lc&""":j

. 'HC'"':'tttf:k ._"

9. LCase
We can use this function to convert Upper Case into Lower Case
Syntax:
lease (String)
Ex: x="SAIRAM"
msgbox lcase(x)
10. Strreverse
We can use this function to reverse the string.
Syntax:
strreverse (String)
Ex: x="SAIRAM"
msgbox strreverse(x)

:I

11. Strcomp
We can use this function to compare two strings
Syntax:
strcomp (String}, String2, Compare)
0
Binary Comparison
Ex:
x=''SAIRAM''

. i

. !

Y="sairam"
If strcomp(x,y,O)=O then

lr--oic""-~t
. . . -r~r----

msgbox "Both are Equal"


else
msgbox "Both are not Equal"
end if
12. Cint
We can use this function to convert given value into Integer.
Syntax:
cint (expression)
Ex: x="l0.54"
msgbox cint(x)
13. Cdbl
We can use thi:o function to con-vert the given value into doubie.
Syntax:
cdbl (expression)
Cstr
We can use this function to convert given value into String.
Syntax:
cstr (expression)
14. Round
We can use this function to rounding the value.
Syntax:
round (expression, No. of decimal places)
Ex: x="10.123456789"
msgbox round(x,3)

~
F

;-

Mr.Venkat (Sr. Test Manager)

Page 36 of 118

F-

15. Split
It is used to return "0" Zero Based one dimensional array containing a specified no. of substrings.
Syntax: Split (expression, delimiter)
Ex: s="lndia is a great country"

arr=split(s, " ")


msgbox arr(O)

India

msgbox arr(l)
msgbox arr(2)

is

msgbox arr(3)

great

= country
Msgbox arr(4)
16. Join
It is used to return a string created by joining a specified no. of substrings contained in an array.
Syntax: join (list, delimiter)
Ex: s="India is a great country"
arr=split(s, " ")
msgbox arr(O)

msgbox arr(l)

India

lS

msgbox arr(2)

msgbox arr(3)

great

msgbox arr(4)

country

msgboxjoin(arr," ")
Note
How to add two variables values.
a="Sai"
b="Ram"
msgbox a&space(lO)&b
17. Space
It is used to create a specific No of spaces
Syntax: space (Number)

18.Rem
It is used to insert comment.
Syntax: rem statement
19. Date
It is used to return current system date.
Syntax: msgbox date

11}9}2008

20. Time
It is used to return cirrrent system time.
Syntax: msgbox time

,.-;-

! tf9tzooa tt:1t:~ AM

21. Now
Syntax: msgbox now

~~tax::~~~~:=~yname(weekday(
18

date))

'!

~~=~
Page 37 of 118

Mr.Venkat (Sr. Test Manager)

Procedures
VB Script has two kinds of procedures
1. Functions (Function Procedure)
2. Procedure (Sub Procedure)

1. Function Procedures:
Perform action & Returns the outputNalue
Syntax:
Function function name()
statements
function name = a+b
End function
Function returns the value with function name.
2. Sub Procedures:
Perform action & doesn't return the output/Value
Syntax:
public sub procedure_name( arguments)
statemets
End sub

User defined Functions


>
>

To create User Defined Functions we can follow below syntax.


Like as programming language 'VB Script' is also allows you to create 'User Defined Functions' for
repeatable operations.
Method 1:
Public I Private Function Function_Name (Arguments)
Statements
End Function
Method 2:
I. Go to Insert menu and click on "Function Definition Generator"
2. Enter name and add parameters and click on [Ok]
Ex:
Public function addition (x,y)
z=x+y
addition= z
End Function

Function LRbra:ry

II

>
>
>

Function library is collection of Functions and Sub Procedures.


Removing the redundancy and Duplication on our Test pack.
Whenever we required to use of this function library, we need to associate this Function library to the.
QTP. So that we can make a call to all the functions wailable in that Function library.
How to create Library File
Navigation
:;.. . Create required function for the required repeatable operations.
f
;; Select the script --7 Copy the Script --7 Paste the script in Notepad --7 Save the file with ".vbs"
extension
i

I
i

Mr.Venkat (Sr. Test Manager)

Page 38

of 118

_r:_

.-~:

~liveTech

fi<tfyiiSiillflu>Wti.. s

How to associate library file to Test before execution

Navigation:
1. File Menu -7 Settings

~ Resources Tab ~ Add Associated function library -7 Browse file path -7

Click Ok.

(Or)
2. How to associate library file during Runtime
Syntax: execute file "Path of file"
Example 1:
Public Function addition (x,y)
z=x+y
addition == z
End Function
Save as .vbs file in Notepad and Associate this to Function library.

'*********************************************************************************
'Calling the above function in Script
a=lO
b=20
c=addition (a,b)
msgbox c

Example 2:
Public Function Login (Usemame, Password)
IS'

for

Systemutil.run "Path of application"


Dialog("Login").WinEdit("Agent Name:").Set Usemame
Dialog("Login").WinEdit( "Password:"). Set Password
Dialog("Login").WinButton("OK").Click
Ifwindow("Flight Reservation").Exist Then
Login=="Test is Pass"
else
Login=="Test is Fail"
End If
End Function

Save ~;ts .vbs file in Notepad and Associate this to Function library.

'*********************************************************************************
'Calling the above function in Script
Result==Login("Venkat","mercury")
11
msgbox Result
r;

o-.-

to the!~
~

![
!

'

I
I

118

Page39of118

Mr.Venkat (Sr. Test Manager)

~liveTech
lktfyltslillfiS<16tti<J
QTPMethods
In QTP mainly we used below methods to automate web application
1. GetVisibleText
2. GetROProperty
3. GetTOProperty
4. GetltemsCoW1t
5. Getltem
6. GetContent

1. GetVisibleText
We can use this method to capture visible text.
Code:
Variable=Window("Window Name").Obj ect("Object Name").GetVisibleText()
2. GetROProperty
>- We can use this method to capture run time property value into variables.
>- We can use this methud to. capture object property "from the application"
Code:
Variable= Browser("Browser Name").Page("Page Name").Object("Object Name").GetROProperty
("Property Name")
3. GetTOProperty
>- We can use this method to capture text object value into variable. Or
>- We can use this method to capture object property value from the object Repository.
Code
Variable = Browser(''Browser Name").Page("Page Name"). Object("Object Name"). GetTOProperty
("Property Name")
Difference between GctVisibleText and GetROProperty:
"' GetVisibletext enables to capture the static text displayed in the specified area.
~
GetROproperty will retrieve the dynamically changing text during run-time.
4. GetitemsCount
We can use this method to count number of items in the Combo box/List Box.
5. Getltem
We can use this method to get a specified item from the Combo Box
6. GetContent
We can use this method to get content of the Combo Box.

!
i
f
r

I;

II

QTP Test Results


1. Report Event
We can use this method to report an event to the Test Result Window.
Syntax:
Reporter.ReportEvent EventStatus, ReportStepName, Details
micPass (0)
micFail (I)
. D one\",...,)
m1c
micWaming (3)
Reporter.Repor1Event micPass, "What we are verifying", "Expected"

Mr.Venkat (Sr. Test Manager)

Page 40 of 1i8

.*liveTech

lirtfy WMfl ..,(,ti,a

It just reports only the contents which is given in double quotes.


Note: mic
->micro
rnicPass
-> microPass
rnicFail
-> microFail

- ..... ?.

2. Print
It is used to display your specified message in Quick Test Print log.
Syntax:
Print "Message"
3. Msgbox
It is used to display specified message in Dialog box
Syntax:
msgbox (''Enter the value")
Ex:
a=lO
b=20
If b=a+ 10 Then
msgbox "b is equal to a"
print "b is equal to a"
reporter.ReportEvent micPass, "b is equal to a", "Test is Pass"
else
msgbox ''b is not eqaul to a"
print "b is not equal to a"
reporter.ReportEvent micFail, "b is not equal to a", "Test is fail"
End If

Execute .exe files from QTP:


Syntax:
Systemutil.Run "-----"'--"Path of exe or To Run URL--------"
or
lnvokeapplication "--------exe Only-------"
Exit Run:
If Exit Run is used, "The control come out from the particular Statement".
Use of QTP Script
For Navigating.
Use of VB Script:
Verifying Expected Result.

-~:-

I
I

I'
i

I
i
18

Mr.Venkat (Sr. Test Manager)

Example for QTP methods and Report Events


Test Scenario 1:
1. Activate Window
2. Enter User Name and Password and Click on [OK]
3. If [Next] is enabled, User is authorized. If next is disabled, User is unauthorized.

!J.se~

Name:

Password:

., " " ~-~'OTmi>J . . Next .. l

..

ophun

Cancel

toX-fL'c.'t.

0 ;/Y) shr053
DtJL:_j ( ''Lc~"''')

D'oJ~Jc ''Log10i).
D cJ.2j

Sh~

cL
lI

Adiva.i--e_
/:J;YJ-e_M

c\

<0 'j . LJ; ~~ ecbt


V)

n:,~ (Lea'"'}

UtSe.r

(I I

\'

If

sh "'OJ :::

\I

IJ;"hHOJ

1 v L1. e

IJ

fVC.-1/VJe

':J sct ll~r

Po.ccS W<-rF') sel


I

,,

LI

C "11!>.1- "). GeH!.opnp"j L''e"cble~

-f{\0..4

[ ~~ e d / u.s ev S au Kon.-<.c-1:

"'' res+

(s p~

11

,_
.. _
l.

t-

r------

Mr. Venkat (Sr. Test Manager)

Page 42 of 118 .,

L_,_

'E
QTP Script
Test Scenario 2:
Book a flight ticket and Verify the booking stored
1. Open the Login window

2. Verify the Login window existence


3. Enter Agent Name, Password and click on [OK]
4. Verify the existence of "Flight Reservation window"
5. Enter the date in "Date of flight" field
6. Select one place from "Fly from"
7. Select one place from "Fly To"
8. Click on [Flights]
9. Verify the existence of"Fiight Table"
10. Select one flight from the "Flights List" and click on [Ok]
11. Enter the Customer Name, No. of Tickets and Select class
12. Click on [Insert Order]
13. Verify "Insert Done" message
14. Open "Open Order ... " Dialog
15. Select the checkbox "Openorder"
16. Enter the OrderNo and Click on [OK]
17. Verify the Ordemo displayed in Flight Reservation
18. Close the application

Real Time Test Script:


' Project Code
: L T 333
'Project Name
: SpiceJet
: Venkat
' Created By
'Date Created
: 19-Nov-2012
'Test case Name
: Indian Airlines
'Test case Objective: Book a Flight Ticket & Verifying the booking Storage
' Expected Result

: Flight ticket must be booked

'************************Variable Declaration***********************************
Option Explicit
Dim strtempContent, OrdNo,OrdNo 1

'***********************Functional Scenario*************************************
' Open the Login \Vindow
System util.Run ".C:\Pro gram FiIesIHP\QuickTest Professional\sampleslfl igh t\appIflight4a. exe"
' Verify login window existence

ii - , ,

If dialog("Login").Exist Then
Reporter.ReportEvent micPass ,"Verifying the Login Dialog","Login Dialog is
displayed"
else
Reporter.ReponEvent micFail ,"Verifying the Login Dialog","Login Dialog is Not
displayed"
'2nd If

Page 43 of 118

18

;----

Mr.Venkat (Sr. Test Manager)


I

~
~

rr
'

-*liveTech

'

'l.

i:

firtfjttstinnsoftttic,ru

1
1

l:
,

'I

' Enter Agent Name and Password


dialog("Login").WinEdit("Agent Name:").Set "mercury"
dialog("Login").WinEdit("Password:").Set "mercury"
' Click on [OK]
dialog("Login").WinButton("OK").Click
1
Verifying Flight Reservation Window
If window("Flight Reservation").Exist Then
Reporter.ReportEvent micPass ,"Verifying the Flight Reservation window", "Flight
Reservation window is Opened"
else
Reporter.ReportEvent micFail ,"Verifying the Flight Reservation window" ,"Flight
Reservation window is Not Opened"
End If
'Enter the date in "Date ofFlight" field
window("Flight Reservation").ActiveX("MaskEdBox").Type "111111"
'Select Place From "Fly From" Combobox
wipdow("Flight Reservation").WinComboBox("Fly From:").Select "Paris"
1
Select Place From "Fly To" Combobox
window("Flight Reservation").WinComboBox("Fly To:").Select "London"
1
Click on Flights Button
window("Flight Reservation").WinButton("FLIGHT").Click
' Verify flights table window
1f window("Flight Reservation").Dialog("Flights Table").Exist Then
Reporter.RepcrtEvent micPass ,"Verifying the Flight Table Dialog","Flight Table' Dialog is
displayed"
Else
Repor1er.ReportEvent micFail ,"Verifying the Flight Table Dialog","Flight Table Dialog is
Not displayed"
End If
' Selecting the flight from the List
windO\v(''Flight Reservation").Dialog("Flights Table").WinList("From").Select(3)
' .Click on [OK]
\vindow("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click
Enter the Customer Name
window("Fli~ht Reservation").WinEdit("Name:").Sd "LiveTech"
1
Enter the No of Tickets
window("Flight Reservation").WinEdit("Tickets:").Set "2"
' Se)ect a Class
window("Flight Reservation").WinRadioButton("Economy").Set
' Click on [Insert Order]
window("Flight Reservation").WinButton("Insert Order").Click
' \Vait tiJJ "Insert Done" message display in control
I

~
~

---

Mr.Venkat (Sr. Test Manager)

Page 44 of 118

..

r;- --

*liveTech
linfy wlinn ..r.h~m

Window("Flight Reservation").ActiveX("Threed Panel Control").WaitProperty "text", "Insert


Done ... ", 30000
'Verify "Insert Done" message
strtempContent=window("Flight Reservation").ActiveX("Threed Panel
Control").GetROProperty("text")
If strtempContent="Insert Done ... " Then
Reporter.ReportEvent micPass ,"Verifying the Insert Done message ","Insert Done message
is displayed"
else
Reporter.ReportEvent micFail ,"Verifying the Insert Done message ","Insert Done message
is Not displayed"
End If
OrdNo= window("Flight Reservation").WinEdit("Order No:").GetROProperty("text")

' Open the OpenOrder Window


window("Flight Reservation").WinMenu("Menu").Select("File;Open Order... ")
' Select the checkbox "Openorder"
window("Flight Reservation").Dialog("Open Order"). WinCheckBox("Order No. "fS~l "ON"
'Enter the OrderNo
window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set OrNo
' Click on (OK]
window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click
' Verify the Orderno displayed in Flight Reservation
OrdNo l =window("Flight Reservation").\VinEdit("Order No:").GetROProperty("text")
s

IfOrdNo = OrdNol Then


Reporter.ReportEvent micPass ,"Verifying the Order No ","Order No is displayed
Properly"
else
Reporter.ReportEvent micFail ,"Verifying the Order No ","Order No is Not displayed
Properly"
End If
'Close the application
Window ("Flight Reservation'').Close

1:
,.-

,-.-

~------

MrVenkat (Sr. Test Manager)

Page 45 of 118

'~

Test Scenario 3:
1. Enter Input 1 & Input 2 Values
2. Click on [OK]
3. Check Result

4. Display Results in Quick Test Print ID


5. 10 Times
[)@) ')(

'"' MUlTIPLY

Far ,-= I -to 16 .


X :::

il)puJ box (

i"'{Ju~ hox (_ u

f..J:VJda.,.J (_

l\

rf\4./-1-ip!J

Sl-p

tl

fuJ.ey
[

1hpq tl

~ f nputJ. ~

r).

~~neJ...;~: ('\lr>p<ftl

rJ. s~t

tr--

)c

W"d,"' ('' "'- /h.P,i'( ''.) ._,;hed."t ( ,, II'JP~H'). Sef y


. t..J;'IdeuJ (_
W; v,

\I

rr

M~l+i Pt}

IV.

w;~\! ~

II ('J

k.

!J

j.

diJ.._

-Ll

\1

""-t/ h. pi_J

1) h o\e./_;f:

(_" Ce S 4. lt ':)- Ce d

c;li(cj ~ c_:cJ- C>J ~ c_....t c.':[)

V", s; b/ey ex!(_

t;

__

i
-
, :-

,...--

'
!f----

'

~
n

~~

-~-

,,

'

- "- -

Mr. Venkat (Sr. Test Manager)


Page 46 of 1 18

~-

..

~~
...

Data Driven Test


Parameterization

>>-

Data driven: Running the test with multiple set of data


Parameterization: It is a variable that is assigned a value from various data sources or
generator.

Parameter types:
1. Data table
}
2. Environment variable
Standard Parameter types
3. Random number
4. Database
5. Text files
6. Excel files

Advanced Parameter types

1. Data table

>>>-

QTP enables you to create and run tests, which are driven by data stored in table
It is used to store the data and parameterize that data to the test script
There are two Sheets by default. (1) Global (2) Action 1
In one data table we will have 256 Sheets. Out of 256 sheets, one sheet is Global and
remaining 255 sheets are Action Sheets.
Two types ofData table
1. Design Time Data Table
2. Run Time Data Table

>
>-

I Difference between Design Time Data Table & Run Time D'1ta Table

I Design time Dat'1 Table


I Run Time D~1ta Table
l j It is vie\ved in the QTP lvfain
-- ---rr-e.s-t:----- ------------------- -- ------------------- - 1j It is viewed in the QTP

Test
. -----.

--------n{es~------------------------

...

. -

2j, It___ is_________created


prior
the test .......---,
I~ It is created. in Test Results
____________
___ to
______________________
______ .. __ after
.. ____ .. ___ _.
/e~eC11tlQJ1.
Ityst executiOn.
3) It represents d::~ta from extemal . JHt represents a live version of__

- ............ ....

.,

:----"'""

_______ ..

"

I - ------ - - --$()\lJC~s.-

.,

--________ . _ _ --- -- - - - ------- ---------- ---- ------

rd.~s-1ii1-t1i11e-nat<1tal1le.-----

-- ---

Create Data driven tests using Data Table

>

>
>

When you test your application, you may want to check how it performs the same operations
with multiple sets of data.
For example,
Suppose you want to check how your application responds to ten separate sets of data. You
could record ten separate tests, each with its own set of data.

_,_

Alternatively,

>
8

You could create a data-driven test with a loop that runs ten times.

t----

Mr.Venkat (Sr. Test Manager)

Page 47 of 118

L
~

Mn

~liveTech

liuFj llslinn wftio.,


1. Design time Data Table
Steps for Parameterization
1. Create Test I Pro gram
2. Defining a Design time Data Table Parameters
3. Adding Parameter Values to a Data Table using Keyword view
4. Running and Analyzing a Parameterized Test

Parameterize a Step
~

In the Keyword View, click in the Value cell of the step and then click the parameterization
ICOn.
: JmAgentName:

-:-

,Set

IMJMI!t ...

Enter "mercur}J" in the "Agent Name:" edit box.

Results
~
~

After running a test, we can view a report of major events that occurred during the test run.
If any iteration is failed report it as a defect using Quality Center 10.0 I Bugzilla 3.2.

~---

i!

2. Run Time Data table (Using Data Table Methods)

I
r

Data Table Methods


1. Add Sheet:

We can use this method to "add" one new sheet to the run time data table.
Syntax: datatable.AddSheet ("Sheet_Name")
Ex
: datatable.AddSheet ("input")

[:;

I
!

2. Delete :
We can use this method to "delete" one specified sheet from the Run Time Data tablP.
Syntax: datatable.DeleteSheet (Sheet_ID)
Ex
: datatable.DeleteSheet (3)

3. GetSheetCount :

i
'

--

r~
lr

r--

We can use this method to count number of sheets in the run time data table.
Syntax: datatable.GetSheetCount
Ex
: msgbox datatable.GetSheetCount

iJ

~'I'
~

4. GetRowCount:
We can use this method to count number of rows in the 1st sheet of the Run tii"e data table.

r----

Mr.Venkat (Sr. Test Manager)

Page 48 of 118

L-

L___

~liveTech
finfy
sdltions
ltsfiiR

Syntax: datatable.GetRowCount
Ex
: msgbox datatable. GetRowCount

ation

un.

18

5. GetSheet:
We can use this method to return a specified sheet from the Run Time data table.
Syntax : datatable.GetSheet(SheetiD)
Ex
: msgbox datatable.GetSheet(l).GetRowCount

' I--

6. Value:
We can use this method to set or get value of cell in the specified parameter and the current row
of the Run time data table.
To get data
Syntax:
Variable= datatable.Value(Parameter_Name, Sheet_Name)
or
Variable= datatable(Parameter_Name, Sheet_Name)
To set data:
Syntax:
datatable.Value(Parameter_Name, Sheet_Name) =Value I variable
or
datatable(Parameter_Name, Sheet_Name) =Value I variable
Ex:
a=datatable.Value (1, 1)
b=datatable. Value (2, 1)
c=cint( a)+cint(b)
datatable. Value (3, 1) = c
7. SetCurrentRow
We can use this method to take a specified row as current row in the Run Time Datatable (By
default it is 1st Row of 1st Sheet)
Syntax: datatable.SetCurrentRow(Row Number)
Ex: s="sairam"
datatable.SetCurrentRow (3)
datatable. Value (1, 1) = s
8. SetNextRow
We can use this method to take the row a~er the current Row as New Current Row in the Run
time data table.
Syntax; data table. SetN extRow
Ex: s="sairam"
datatable.SetCurrentRow (3)
datatable.SetNextRow
datatable.Value (1,1) = s
9. SetPrevRow
We can use this method to take the row before the current Row as New Current Row in the Run
time data table.
Syntax: datatable.SetPrevRow

Mr.Venkat (Sr. Test Manager)

Page 49 of 118

r----..,

r---

f--

I!

r-~

f-----

r----

f[

I-

~liveTech
fU,tfyltstiiJoS<!Illti..s

Ex: s="sairam"
I
datatable.SetCurrentRow (3)
datatable.SetPrevRow
datatable.Value (1,1) = s
10. Import
We can use this method to import Microsoft Excel File to the Runtime Data Table (Including all
sheets)
Syntax: datatable.Import "Path of File"
Ex
: datatable.Import "F:\Inputdata.xls"
f
lmportSheet
!
We can use this method to import a specified sheet of Microsoft Excel Sheet to the Runtime Data
table.
Syntax : datatable.ImportSheet "Path of File", "Source Sheet", "Destination Sheet"
'
Ex
: datatable.ImportSheet "F:\Inputdata.xls",3,1
t
11. Export
[
. !
We can use this method to export a copy of Run Time Data table to another location (Including '
i
all sheets)
.1
Syntax : datatable.Export "Path of File"

{
Ex
: datatable.Export "F:\Outputdata.xls"
i

t-

l
!

~~~

We can use this method to export a copy specified sheet of Run Time Data table to the
existing or new Excel File.
Syntax: datatable.ExportSheet "Path of File", "Sheet Name I Source Sheet"
Ex
: datatable.ExportSheet "F:\Outputdata.xls", 2

I
[
l
''

Scripts using Datatable


1. Create a script for Flight Reservation Login and taking login credentials from Runtime
Data table
2. Verify Calculation Test
3. Verify Flight Reservation Orders
4. Prepare script for [Update Order] behavior, When we open an Order (Update Order]
should be disabled
5. Create a script for Project Login and taking login credentials from Runtime Data table
Test Scenario 1:
Create a script for Flight Reservation Login and taking login credentials from Runtime
Data table.
Steps:
1. Create Folder Structure
Framework ~ Repository, Test Data, Test Script and Test Log
2. Create "Login.xls" and copy into "TestData" folder (AgentName, Password and Test Result)
3. Create Object Repository and Export into Repository folder and Associate Repository
4. Create Script
5. Enter Login values and Run Script
6. Observe "TestLog" folder for Test Resutls

Mr.Venkat (Sr. Test Manager)

Page 50 of 118

_r;_

t-ti

_,_
!=

f
f

I
(

l
f

Option Explicit
Dim RowCount, i
Datatable.AddSheet "Input"
Datatable.ImportSheet "C:\QTP_ Examples\WBMS\Frameworks\Test Data\Login.xls", 1, "Input"

-. __

~-

all
RowCount= Datatable.GetSheet("Input").GetRowCount

lata

I!

For i=1 to RowCount Step 1

II

Datatable.SetCurrentRow(i)

l'

Systemutil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe"

I
I

'

ne

Dialog("Login").WinEdit("Agent Name: ").Set Datatable.Value("AgentN arne", "Input")


Dialog("Login").WinEdit("Password:").Set Datatable.Value("Password","Input")
Dialog("Login").WinButton("OK").Click
If window("Flight Reservation").exist Then
Reporter.ReportEvent micPass, "Verify Login","Test is Pass"
Datatable.Value("TestResult", "Input")="Test is Pass"
Window("Flight Reservation").Close
else
Reporter.ReportEvent micFail, "Verify Login","Test is Fail"
Datatable.Value("TestResult", "Input")="Test is Fail"
Dialog("Login").Dialog("Flight Reservations").WinButton("OK").Click
Dialog("Login").WinButton("Cancel").Click
End If

f:
i

r--~

I,-,-

Next

'Export Results to Test Log


Datatable.ExportSheet "C:\QTP _Examples\WBMS\Frameworks\Test Log\Result2.xls;',"Input"

Test Scenario2:
Conduct Data Driven Test on for Flight Reservation calculation test using Runtime Data
table.
Option Explicit
Dim RowCount,i,OrdNo,Tickets,Price,Prc,Total,Tot

'-~-

r---F.--

Datatable.AddSheet "Input"
Datatable.AddSheet "Output"
Datatable.GetSheet("Output").AddParameter "OrderNumber",""
Datatable.GetSheet("Output").AddParameter "Tickets",""
,.___ _

r-=--~~

Mr.Venkat (Sr. Test Manager)

Page 51 of 118

i---

~liveTech
fkelj lesli!1
wftin.

Datatable.GetSheet("Output").AddParameter "Price",""
Datatable. GetSheet("Output").AddParameter "Total",""
Datatable. Get~heet("Output") .AddParameter "TestResult",""

Datatable.ImportSheet "C:\QTP_Exflmples\WBMS\Frameworks\Test
Data\Input.xls","Sheetl ","Input"
RowCount= Datatable. GetSheet("Input"). GetRowCount
For i=l to RowCount Step 1
Datatable.SetCurrentRow(i)
OrdNo=Datatable.Value("OrderNumbers","Input")
Window(" Flight Reservation") .Activate
Window("Flight Reservation").WinMenu("Menu").Select "File;Open Order... "
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No. ").Set "ON"
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set OrdNo
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click

~---

II
(

Tickets= Window("Flight Reservation").WinEdit("Tickets:").GetVisibleText()


Price=Window("Flight Reservation").WinEdit("Price:").GetVisibleText()
Pre= mid(Price,2,len(Price)-1)
Total=Window("Flight Reservation"). WinEdit("Total: ").Get Visibl eT ext()
Tot=mid(Total,2,len(Total)-I)
If Cint(Tickets)*cdbl(Prc)=cdbl(Tot) Then
Reporter.ReportEvent micPass, "Verify Total","Calculation Test is Pass"
Datatable. Value("OrderNumber"," Output")=OrdNo
Datatable. Value("Tickets", "Output")=Tickets
Datatable. Value("Price", "Output")=Prc
Datatable.ValueC'Total","Output")=Tot
Datatable. Value("TestResult", "Output")="Test is Pass"
else
Reporter.ReportEvent micFail, "Verify Total","Calculation Test is Fail"
Datatable.Valqe("OrderNumber","Output")=OrdNo
Datatable. Value("Tickets", ''Output")=Tickets
Datatable.Value("Price","Output")=Prc
Datatable. Vafue("Total", "Output")=Tot
Datatable.Value("TestResult","Output")="Test is Fail"
End If

~-----

Next
'Export Results to TestLog folder
Datatable.ExportSheet "C:\QTP_Examples\ WBMS\F rameworks\Test
Lo g\CalculationResult.xls", "Output"

~
~
,.

r--

Mr.Venkat (Sr. Test Manager)

Page 52 of 118

L__

t==-

II
f

I
I

Test Scenario 3:
Verify Flight Reservation Orders
Option Explicit
Dim RowCount,i,OrderNumber, OrdN o

I-

Datatable.AddSheet "Input"
Datatable.ImportSheet "C:\QTP_Examples\Test Data\Orders.xls","Input","Input"
RowCount= Datatable. GetSheet("Input "). GetRowCount

I
I

I
I
i

For i=1 to RowCount Step 1


Datatable.SetCurrentRow(i)
OrderNumber=Datatable.Value("OrderNumber","Input")
Window("Flight Reservation").WinMenu("Menu").Select "File;Open Order..."
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No. ").Set "ON"
Window("Flight Reservation").Dialog("Open Order"). WinEdit("Edit").Set OrderNumber
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click
OrdNo=Window("Flight Reservation").WinEdit("Order No:").GetVisibleText()

I
j

I
I

I
I
I

I
I

If OrdNo=OrderNumber Then
Reporter.ReportEvent micPass, "Verify Order","Test is Pass"
Datatable.Value("TestResult","Input")="Test is Pass"
else
Reporter.ReportEvent micFail, "Verify Order","Test is Fail"
Datatable.Value("TestResult","Input")="Test is Fail"
End If Next
'Export Results to "TestLog"
Datatable.ExportSheet "C:\QTP _Examples\Test Log\OrderResults.xls", "Input"

t=

r--

Test Scenario 4:
Prepare script for [Update Order] behaviour, When we open an Order [Update Order]
should be disabled. (Conduct data driven test)
Option Explicit
Dim Ro}vCount,i,OrderNumber,strMsg
Datatable.AddSheet "Input"
Datatable.ImportSheet "C:\QTP_ Examp1es\WBMS\Frarrieworks\Test Data\Orders.xls", 1,3
RowCount= Datatable. GetSheet(3 ). GetRowCount
For i=1 to RowCount Step 1
Datatab 1e. SetCurrentRow(i)
OrderNumber=Datatable.Value("OrderNumber",3)
Window("Flight Reservation").WinMenu("Menu").Select "File; Open Order..."
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set "ON"
Window("Flight-Reservation").Dialog("Open Order").WinEdit("Edit").Set OrderNumber
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click

Mr.Venkat (Sr. Test Manager)

Page 53 of 118

""

strMsg=Window("Flight Reservation").WinButton("Update Order").GetROProperty("enabled")


IfstrMsg="false" Then
Reporter.ReportEvent micPass,"VerifY UpdateOrder","Update Order is Disabled, Test is Pass"'

Datatable.Value("TestResult",3)="Test is Pass"
else

J--

Reporter.ReportEvent micFail,"Verify UpdateOrder","Update Order is Enabled, Test is Fail"

Datatable.Value("TestResult",3)="Test is Fail"
End If
Next
'Export Results
Datatable.ExportSheet "C:\QTP_Examples\Frameworks\Test Log\UpdateResults.xls", 3
Test Scenario 5:
Create a script for Project Login and taking login credentials from Runtime Data table

r~---

~!--

Mr.Venknt (Sr. Test Mnnngcr)

P:1gc 54 of 118

')

~livelech
Bvtfy ustinoso6t!Wns
2. Environment Variable

II
!

'

Environment Variables are two types such as


1. Built-in-variable
2. User defined variable

[
'
1

f'
r

f
f
f

(
I

!
i
}
f
f

i
I
J
!

1. Built-in-variable
It represents the information about the Test and the system in which the test is running.
Ex:
1. Environment.Value ("OS") (It will display Operating System)
2. Environment.Value ("OSVersion") (It will display operating system version)
3. Environment.Value ("LocalHostName") (It will display Local Host Name)
4. Environment. Value ("Test Name") (It will display Test Name)

2. User defined variable


Method 1:
File 0 SettingsO Environment 0 Variable type 0 Select User defined
~

Click on Add(+)
~ Enter variable name and value and click on [Ok]
Retrieving variables using Keyword View:
1. Go to Keyword view and Select value configurations window
2. Select Parameter as "Environment"
3. Select Name and Value and click on [Ok]

Method 2:
1. External Variables will be present in the ".xml" file and we can associate this 'xml' file to the
test to use those variables in any action of that test.
2. To create 'xml' file with required variables we can prepare script likes as below.
3. Open Notepad ->Prepare script like as below -> Save the file with '.xml' extension.
<Environment>
<Variable>
<Name>usemame</N arne>
<Value>pmc<N alue>
<Nariable>
<Variable>
<N ame>password</N arne>
<Value>pmc<N alue>
<N ariable>
</Environment>

How to associate .xml file to Test before execution:

_:\_

Navigation:
_
1. File-> Settings-> Environment 0 Variable type (User Defined One) 0 Select 'Load variables
and Values from external file" 0 Browse and Select .xml file and click on [Ok]
(or)
2. How to associate .xml file during Runtime Syntax
Environment.LoadFromFile "Path ofXML file''

[
rr- -----:1

ati-~

Retrieving Environment Variables in QTP Test:


Environment. Value("U semame")

"-~

--

~----

Mr.Venkat (Sr. Test Manager)

Page 55 of 118

r=-----1

~liveTech
liury ttsliiJI Sd!tW.
Test Scenario 1:
Create a script for Project Login and taking login credentials (URL, Username and
Password) from Environment variables.
1. Create an XML file with values ofURL,Username and Password.
2. Associate XML file to QTP test

Systemutil.Run Environment.Value("StrURL")
Browser("PMC Inc. ").Page("PMC Inc. ").WebEdit("Userld").Set Enviromnent. Value("Userld")
Browser("PMC Inc. ").Page("PMC lnc.").WebEdit("Password").Set Environment.Value("Password")
Browser("PMC Inc. ").Page("PMC Inc. ").WebButton("Submit").Click
Browser("PMC Inc.").CloseA11Tabs

Test Scenario 2:
Create a script for Flight Reservation Login and taking login credentials (URL, Username
and Password) from Environment variables.
XML File and Script:

3. Randon1 Number

~"-

---

1. Go to Keyword view and Select value configurations window


2. Select Parameter as "Random Number"
3. Enter Numeric range From as "1" and To as "9" and Click on [Ok)
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set RandomNumber( I, 100)

:=--------

Mr.Venkat (Sr. Test Manager)

Page 56 of 118

~-

~llveTech
fwtfy

ttsli/Jg sdlili<Js

4. Database (Advanced Parameter Types)

1
(

II

1. VB Script is Object Based Language


2. It doesn't support external files directly, When we want work External files and we
Create Object .
3. External files are Database, Text files, Excel files and Word ... etc.,

Syntax:
Set Objectname=CreateObject("Servemame.Classname")
Servemame = ADODB
Classes are:
1. Connection
2. Command
3. Recordset

l'

1. Connection

r
r
'[

ne~d

to

We can use this class to establish a connection to the specified database during Runtime
Syntax:
Set ObjCon = CreateObject("ADODB.Connection")
ObjCon.open "Provider-Provider Name"
Example:
MSAccess
ObjCon.open "Provider-Microsoft.Jet.OLEDB.4.0;Data Source=Path ofDatabase"

'0
)

SOL Server
ObjCon.open "Provider-sqloledb.l; Server=IP Address; uid=Usemame; pwd=xxx;
database=database name"
Oracle
ObjCon.open "Provider=oraoledb.l; Server=xxx;
useriD= U semame(scott); password=xxx( tiger)"

Note:

l
i

i
I

1. ADODB means Activex data object database


2. oledb Object linking embedded database

Note:.
To get provider Name
1. Open Notepad ~ Save empty file with .udl extension
2. Open that udl File~ Provider Tab~ Select Provider -7 Next -7 Select Database -7
Test Connection ~ Click Ok -7 Click Ok
3. Open same file in Notepad and copy Provider Name to Script
2. Command
We can use this class to execute specified DML Statements (Insert, Update, Delete) on
connected database.
Code:
Set ObjCom=createObject ("ADODB.Command")

Mr.Venkat (Sr. Test Manager)

Page 57 of 118

f--~
~

r;

ObjCom.ActiveConnection = conobj
ObjCom.CommandText = "SQL Statement"
ObjCom.Execute
3. Recordset

J
i

We can use this class to execute specified select statement on connected database and
retrieve the results.
Code:
Set ObjRS = createObject ("ADODB.recordset")
ObjRS.open "SQL Statement", conobj
4. Nothing
Noting is a keyword in VB Script, which is used to disassociate an object variable from the
actual object.
Code:
Set objectname = nothing

I
(

I
l

I
I

Create MS Access Database- Test Pun..1ose


Navigation:
1. Start~ Programs~ Microsoft Office-7 MSAccess
2. File~ New~ Blank Database~ Enter Database name "SampleDB" and [Creaie]
3. Click on 'Create Table in Design View'
4. Enter Field names as Usemame and Password and click on (Save]
5. Enter table name as 'Login' and click on [Ok]
Script 1:
How to set data into database table
Option Explicit
Dim ObjCon,ObjCom
Set ObjCon=CreateObject("ADODB.Connection")
ObjCon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\QTP_Examples\WBMS\Others\SampleDB.mdb;Persist Security Info=False"
Set ObjCom=CreateObject(" ADODB.Conunand")
ObjCom .ActiveConnection=Obj Con
ObjCom.CommandText ="Insert into Login values('Venkat','mercury')"
ObjCom.Execute
ObjCon.Close
Set ObjCom=nothing
Set ObjCon=nothing

t-----

.~ ___
Fmu

Mr.Venkat (Sr. Test Manager)

[L _ _
-

Page 58 of 118

,.

-:

~LiveTech
ustin "''"ti""'
firtfy

Script 2:
How to set multiple records into database table by taking the data from Excel file
Option Explicit
Dim ObjCon,ObjCom, RowCount,i,Uname,Pwd
Set ObjCon=CreateObject("ADODB.Connection")
ObjCon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\QTP_ Examples\WBMS\Others\SampleDB.mdb;Persist Security Info= False"
Set ObjCom=CreateObject("ADODB.Command")
Obj Com.ActiveConnection=Obj Con
Datatable.AddSheet "Input"
Datatable.ImportSheet "C:\QTP_ Examples\WBMS\Frameworks\Test
Data\Login.xls","Sheetl ","Input"
RowCount=Datatable.GetSheet("lnput").GetRowCount
For i=1 to RowCount Step 1

Datatable.SetCurrentRow(i)
Uname=Datatable.Value(" AgentN arne", "Input")
Pwd=Datatable.Value("Password","Input")
ObjCom.CommandText ="Insert into Login values("'&Uname&'","'&Pwd&"')"
ObjCom.Execute
Next
ObjCon.Close
Set QbjCom=--nothing
Set ObjCon=nothing

Script 3:
'How to get data from the dat:1b:1sc table

'

;,

:!
'"

:, :\

l :;

Option Explicit
Dim ObjCon,ObjRs,Var

Set ObjCon=CreateObject("ADODB.Conncction")
ObjCon.Open "Providcr==l\1:::osotUet.OLEDB.4.0:D:It~l
Source=C:\QTP _Examples\\VBMS\Others\SnmplcDB .mclb;Pcrsist Security Info= False"
Set ObjRs=CreateObject("ADODB.Recordset")

!!

~--

i~
j

I~

1-.-

Mr.Venkat (Sr. Test Mannger)

Page 59 of 118

c.:_--=-=-='
~

In-

'

,. ....:-.-c

~ ~

ObjRs.Open "Select* from Login",ObjCon


ObjRs.MoveFirst
While not ObjRs.EOF
Var=ObjRs("U sername")
Print Var
ObjRs.MoveNext
Wend
ObjRs.Close
ObjCon.Close
Set ObjRs=nothing
Set ObjCon=nothing

Script 4:
Verify Login using data from Data base
Option Explicit
Dim ObjCon,ObjRs,Uname,Pwd
Set ObjCon=CreateObject("ADODB.Connection")
ObjCon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\QTP_ Examples\WBMS\Others\SampleDB.mdb;Persist Security Info=False"
Set ObjRs=CreateObject("ADODB.Recordset")
ObjRs.Open "Select* from Login", ObjCon
ObjRs.MoveFirst
While not ObjRs.EOF
Unnme=ObjRs("Usernnmc")
Pwcl=ObjRs(" Password")
Sy~~t cmut i I. Run "C: \I; tu g1;1 ::1 Fi lcs\11 P\Ql! i ck'T'csl 11 mtession:ll\!l ight\app\!l ight4a.cxc"
Di;llog("L,;gitl").WiJ:Lclit("A:;t~'ll !'\:::11c:").Sc:t Ln:!t~ic:
Di:tlog(" l.ugin"). Wint:-:di!("P:tss\'..-oJci:") . .:.;Ll Jlwd
D i :1l ~ '!;/'' L~:_~_i 1: ").\Vi:: ~j lil :, '11( "0 K ").CI i ~.k

11.\Vindo\'.'("lTgilt l~csct\:lliun").!:xiq

Ti1C'i1

Reporter. 1-Zcpori [nnl mi~l):1ss, "\' ui l\ L.u~~.in'',"T ~st is 1':1ss"


p1int "Login :;~:~cc:->s"
wi nclow(" Fl i gh l P. cscrv:1l inn"). C! n: ~.:

"-,;'

.;

else
Rcportcr.Rcp.~t[>-'L'lll micF:1i!,

"V c1 i l\:
L\):.;in","Tc:st is Fail".
.

print "Login F:lilcc\''


Dialog(" Logi 11 "). D i :dog(" fl igh! l~ cscrval io11S"). Wi nButton("OK").Ciick

r----Mr.Vcnkat (Sr. Test Manager)

i.

Page 60 of 118

"--"--

Dialog("Login "). WinButton("Cancel ").Click


End If
ObjRs.MoveNext
Wend
ObjRs.Close
ObjCon.Close
Set ObjRs=nothing
Set ObjCon=nothing
l

I,
I
I
I

I.-

I
~

Script 5:

'Data Base Testing


Option Explicit
Dim RowCount,i, CN arne, Tickets, ObjCon, ObjRS, OrdN o
Datatable.AddSheet("Input")
Datatable.ImportSheet "C:\12315\WBMS Framework\Test
Data\Customers.xls", "Sheet I ","Input"
RowCount=Datatable.GetSheet("Input").GetRowCount
Set ObjCon=CreateObject("ADODB.Connection")
ObjCon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program
Files\HP\QuickTest Professional\samples\flight\app\flight32.mdb;Persist Security Info=False"

For i=l to RowCount Step l


Datatable.SetCurrentRow( i)
CN ame=Datatable. V alue("CustomerN ame", "Input")
Tickets=Datatable.Value("Tickets", "Input")
Window("Flight Reservation").Activate
Window("Flight Reservation'').WinMenu("Menu").Select "File;New Order"
Window("Flight Reservation").ActiveX("MaskEdBox").Type "111112"
Wi~dow("Flight Reservation").WinComboBox("Fly From:").Select "Frankfurt"
Window("Flight Reservation").WinComboBox("Fly To:").Select "Los Angeles"
Window("Flight Reservation").WinButton("FLIGHT").Click
Window("Flight Reservation").Dialog("Flights Table").WinList("From").Select "20331 FRA
09:12AM LAX 04:23PM AA $112.20"
V..'indow("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click
Window("Flight Reservation"). WinEdit("Name: ").Set CN arne
Window("Flight Reservation").WinEdit("Tickets:").Set Tickets
Window("Flight Reservation").\VinButton("Insert Order").Click
Window("Flight Reservation").ActiveX("Threed Panel Control").WaitProperty "text", "Insert
Done... ", 20000
OrdNo=Window("Flight Reservation").WinEdit("Order No:").GetROProperty("text")

I
'

L__

'~

l~
t_
~~

i'

~-

Mr.Venkat (Sr. Test Manager)

Page 61 of 118

f --

Set ObjRS=CreateObject(" ADOD B.RecordSet")


ObjRS.Open "Select* from Orders where Order_Number="&OrdNo,ObjCon
If ObjRS("Customer_ Name")=CN arne Then
Print "DB Testing Pass"
else
Print "DB Testing Fail"
End If
Next
Obj Con. Close
Set ObjRS=nothing
Set ObjCon=nothing

Script 6:
Oracle Example- Project Data
Option Explicit
Dim ObjCon,ObjRS
Set ObjCon=CreateObject("ADODB.Connection")
ObjCon.Open "Provider=MSDASQL.l ;Password=wbms;Persist Security Info=True;User
ID=wbms;Data Source=wbms"
Set ObjRS=CreateObject("ADODB.RecordSet")
ObjRS.Open "Select* from user_tbi",ObjCon
ObjRS.MoveFirst
While not ObjRS.EOF
msgbox ObjRS("UNAME")
ObjRS.MoveNext
Wend
ObjCon.Close
Set ObjRS=nothing
Set ObjCon=nothing

r
r-- -

i!

tL__

'

F----=-=--=--:

Mr.Yenkat (Sr. Test Manager)

t__ -- -

Page 62 of 118

!'

om-

l
5. File System Object (FSO)(Text Files)
>~

This is one of the objects provided by the VB Script.


We can create folders, files in our Machine.

r,.J,

Syntax:

1 't:

~
,j-:

To Create a folder:

'~

ObjFSO.createFolder("C:\LiveTech")

To Create a file:
ObjFSO.createTextFile("C:\LiveTech\Testing.txt")

To write the Data into text file


Set objFSol =objFSO.Createtextfile("C:\LiveTech\Testing.txt")

This object holds the path of the text file


objFSO 1. write line "LiveTech is a G0od Testing institute"
objFSOl.writeline "LiveTech is in Ameerpet"

To close the Opened file (Which we are opened for writing the Data)
objFSOl.Close

To Delete the Folder file:


obj FSO .Deletefolder(" ----path----")
obj FSo .Deletefi le(" ----path----")

To Delete the Object:


Set ObjFSO==Nothing
This object is going to Delete.

Script 1:
How to Create Folders, Files and Test Data

II
I
I

Set ObjFSO ==CreateObject("Scripting.FileSystemObject")


ObjFSO.createFolder("C:\LiveTech")
ObjFSO.createTextFile("C:\LiveTech\Testing.txt")
Set abc=ObjFSO.CreateTextFile("C:\LiveTech\Testing.txt")

'This object holds the path of the text file


abc.writeline "LiveTech is a Good Testing institute"
abc.writeline "LiveTech is in Ameerpet"

Flat File:

Some times we are conducting data driven testing depending on multiple test data from "Text" files .
To manipulate flat file content for testing we can prepare script like as below .
Set fso = createobject("Scrpiting.filesystemobject")
Set f=fso.opentextfile ("Path of text file", mode[Read-1, Write-2, Append-S])
while f.atEndOfline == false
s==f. readline

. t---

r:

............ sets

Mr.Venkat (Sr. Test Manager)

:r ,

Set ObjectName ==CreateObject("Scripting.FileSystemObject")


Set ObjFSO ==CreateObject("Scripting.FileSystemObject")

Page 63 of 118

~-:__:____

.~.~

f ...

Wend
fclose

Script 2:
Login using Data from Text File:
'Create a text file with values of password and save into C:\
Option Explicit
Dim ObjFSO,ObjRD,User
Set ObjFSO = createobject("Scripting.filesystemobject")
Set ObjRD=ObjFSO.Opentextfile ("C:\LiveTech\Testing.txt",l)
While ObjRD.atEndOfline =false
User=ObjRD.readline
Systemutil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe"
Dialog("Login'').WinEdit("Agent Name:").Set User
Dia1og("Login").WinEdit("Password:").Set User
Dialog("Login "). WinButtofl("OK ").Click
Window("Flight Reservation").Close
Wend

ObjRD.close
Set ObjRD=nothing
Set ObjFSO=nothing

QTP More Methods:

L
"

1. GetitemsCount()
2. Getltem()
3. GetContent()

r:

1. GetltemsCqunt
We can use this method to count number of items in the Combo bo:x/List Box.
2. Get!t'ml
We can use this method to get a specified item from the Combo Box

3. GetContent
We can use this method to get content of the Compo Box.

~
~

--

i_ _

Mr.Venkat (Sr. Test Manager)


Page 64 of 118

~'
o:..:=.::.:

Script 3:
Example for GetltemsCount(), Getltem() and GetContent()
Option Explicit
Dim Itemscount, Item_Flyfrom,Contect-Flyfrom
Itemscount_Flyfrom=window("Flight Reservation").WinComboBox("Fly From:").GetltemsCount()
Item_Flyfrom=window("Flight Reservation").WinComboBox("Fly From:").Getltem(l)
Content_Flyfrom=window("Fl ight Reservation") .WinComboBox("Fly From:"). GetContent()
print ltemscount_Flyfrom
print ltem_Flyfrom
print Content_Flyfrom

Script 4.
How to count number of items in the Fly From Combo Box and bow to display their name one by
one.
Option Explicit
Dim ltemCount,i,ItemVal
ltemCount=Window("Flight Reservation").WinComboBox("Fly From:").GetltemsCount()
For i=O to ItemCount-1 Step 1
ItemVal=window("Flight Reservation").WinComboBox("Fly From:").Getltem(i)
Print ItemVal
Next

Script 5:
How to display FlyFrom Combo Box items one by one into Notepad Option Explicit
Option Explicit
Dim ObjFSO,Obj\VL,ltemCount,i, ItemVal
Set ObjFSO=CreateObject(''Scripting.FileSystemObject")
Set ObjWL=ObjFSO.OpenTextFile("C:\LiveTech\FlyFrom.txt",2)
ltemCount=Window("Flight Reservation").WinComboBox("Fly From:").GetltemsCount()
For i=O to ItemCount-1 Step 1
ItemVal=window("Flight Reservation"). WinComboBox("Fly From:").Getltem(i)
ObjWL.Writeline ItemVal
Next
ObjWL.Close

,-_,'
~

Set ObjWL=nothing
Set ObjFSO=nothing

Page 65 of 118
Mr.Venkat (Sr. Test Manager)

~~~-

r=
ij

Script 6:
How to display Flyfrom Combo box items one by one into Runtime Data table and the same data
table export to Excel Sheet
Option Explicit
Dim ObjFSO,ObjWL,ItemCount,i, ItemVal
Datatable.AddSheet "Output"
Datatable. GetSheet("Output").AddParameter "FlyFrom", ""
ItemCount=Window("Flight Reservation").WinComboBox("Fly From:").GetitemsCount()
For i=O to ItemCount-1 Step 1
Datatable. SetCurrentRow(i+ 1)
Item Val=window("Flight Reservation").WinComboBox("Fly From: ").Getltem(i)
Datatable. Value("FlyFrom", "Output")=Item Val
Next
Datatable.ExportSheet "C:\QTP_Examples\ WBMS\Frameworks\Test Log\FlightLocation.xls" ,"Output"

Script 7:
How to verify update Order behavior in the Flight reservation application and how to pass multiple
values from the text me - File System Object(Text Files)
Option Explicit
Dim fso,f,s,arr,strStatus
Set fso=CreateObject("Scripting.filesystemobject")
set f=fso.OpenTextFile("E:\Records.txt", I)

While not f.AtEndOfStream


s=f.ReadLine
an-=split(s." ")
Window("Flight Reservation").WinMenu("Menu").Select "File;Open Order... "
Window(" Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set "ON"
Window(" Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set arr(l)
Window(" Flight Reservation").Dialog("Open Order").WinButton("OK").Click
strStatus = Windmv("Flight Reservation").WinButton("Update Order").GetROProperty("Enabled")
If strStatus="False'' Then
Reporter.ReportEvent micPass,"Update is Disabled","Test is pass"
Else
Reporter.ReportEvent micFail,"Update is Enabled","Test id failed"
End If

::
C<

~------

tr,

-:-

\Vend
f. Close
Set fso=nothing

Mr.Venkat (Sr. Test Manager)

Page 66 of 118

~liveTech
finry
"'''ti"
ttsrinn

6. Excel Files
Excel Object:
This is one of the objects provided by the VB Script.
)> We can create Excel files, Workbooks, Sheets and Colors in our Machine.
Syntax:
Set Object Name= Createobject ("Excel.application")
Set objExcel=Createobject ("Excel.application")
)>

Script 1:
How to create below excel file and how to save in framework folder
A
I B
_1_ l11pt1t 1 J!.~p~~1?

_1_ -~
;

c
Result

-----t

- +- _ _ _- ~- _ _ _ _ _ -+ t

,_ _ _ ___

set obJExce.l ~ c~aleC!qJecl:C ll ex.ce.L AppU c_o.h'cn

':J

=t-?Ue

ol<J [xcel_-v,..sble_

GbJucel "'--ovkhouKS A d..d.___

Sci obJ~hE?ef: ~ obiCxce.( Acll've.Sheel:


a~jSheei cel/.s CiJ ) ==
.S1
.

c.\~.ice.U ' ::: 0

c~ c~u 1 , f~. c
.

chJcS~'
Lc;eJ

1..: , ~~
CAJ ,s "'t'et-..

!npu-1::

Lt

1J

or .:-::. v bBilte_

O~/ ce___LU_ ~

i
l/

ll

L_

~;

C bJ u:.U;;( . 1.=-w . Co I vr ::. V

ob_J_)~-ec__t:. cc..fl._s ( t;,l):::

eel t;.(

J- ~ npuc ...:L ;
al:JJ s h-e.e-. - I
c~ G0

ce)lr
(_
l0

o~ ceLJ3

111

1,

" - "-

r (_

bg l u_ e_

f?t;Julf:-'1

:: ObjtSLrecl . cclls

L '/ 0.)

..----~--------

r,

qkj CLlL ,'3 F c CcJ 1crv ~ vhe; rt?QJJ

r10

S&

obj J.-..J~ =-

oQ}t-J(3 .. s~.s

dhj[:x-cel_. Ach'veJ..Jovkbook.
u

c \ \ 1-3JE \ t;Gpp(YJ(___

~y~W&YK\ 1e.o+ ~ \ '[:t_cej)<'-XI.S

CQj ENe-\ (\?\1 ;~::: Mr.Venkat (Sr. Test Manager)

11
-,.-

=------

Page 67 of 118

Script 2:
How to validate Update Order behavior and set results into excel file
Set objExcel=Createobject ("Excel.application")
objExcel. Visible=True
objExcel. Workbooks.Add
set objSheet=objExcel.ActiveSheet
objSheet.cells(l, 1)="Status"
set c1=objSheet.cells(1,1)
c 1.font.color=vbblue
Window(" Flight Reservation"). WinMenu("Menu"). Select "File; Open Order..."
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No. ").Set "ON"
Window("Flight Reservation").Dialog("Open Order"). WinEdit("Edit_2").Set "2"
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click
strMsg = Window(''Flight Reservation").WinButton("Update
Order"). GetROProperty("Enabled ")
If strMsg="False" Then
Reporter.ReportEvent micPass,"Update is disabled ","Test is Pass"
obj Sheet.cells(2, 1)="Update is disabled "
Set c2=objSheet.cells(2,1)
c2.font.color=vbgreen
else
Reporter.ReportEvent micFail,"Update is Enabled","Test is Fail"
objSheet.cells(2,1)="Update is Enabled"
Set c2=obj Sheet.cells(2, 1)
c2. font.color=vbred
End If
set objWbook=objExcel.ActiveWorkbook
objWbook.SaveAs "E:\Venkat.xls"
objExcel. Quit
Set objExcel=nothing
Script 2:
How to validate Update Order behavior and pass data from excel file
Set objExcel=Createobject("Excel.application")
objExcel. Visible=True
set objBook=objExcel.Workbooks.Open("E:\Demo.xls")
set objsheet=objBook.ActiveSheet

-"-

"

for i=2 to objsheet.usedrange.rows.count step 1

Var=objsheet.Cells(i, I)
Window("Flight Reservation").Activate
Window("Flight Reservation").WinMenu("Menu").Select "File;Open Order. .. "

r-- ------

Mr.Venkat (Sr. Test Manager)

Page 68 of 118

-~~

Window("Flight Reservation").Diaiog("Open Order").WinCheckBox("Order No.").Set "ON"


Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit_2").Set Var
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click
strMsg = Window("Flight Reservation").WinButton("Update
Order").GetROProperty("Enabled")
If strMsg="False" Then
r
~'

Reporter.ReportEvent micPass,"Update is disabled ","Test is Pass"


else
Reporter.ReportEvent micFail,"Update is Enabled","Test is Fail"
End If
Next
objExcel. Quit
Set objExcel=nothing

rr

I~
~

L
~

r:

~r~
~

-~i-

:=---

Page 69 of 118
Mr.Venkat (Sr. Test Manager)

;;

L_

----,.-
5

~:!-~

J,,,;

_,....;;r.-~.. -"-

.f?.ri?o'i--';;-.-, ...

Oo:ta. 0-t",ven Te.s-t ;rJj

~~ced~~!!JPBJ
1

:-t

<
(1)

pcJ-o- 6 c.8

Doln-l<>bie. - [R.or [

----------'7\

.[V)\I(y-cn~ .)(:~

S Lr;pt;

~ t~tV ~-l:l

~WE':

Pa.._Jo,.,

seJ: " ~ ("' ~ c v-eoJe &!i e oi:['. ADO OS . cof)mec_hw, 1)


sel: obj Col

~ c r&>k Ql,jed (', ftoo o 6

5oct chi 10

Te;,q {r l..e.J

occ~,,J-o,~,

-~

.-

.L Ll.rc.hO?
<AoD'3

6!}
1

C
CD

hcl'flsJ\

jftl

-fl-o oc;he e1-/

1 me.H.,_O<k, -

="""""'
s~/c,eJshe<icfaeJ: e=o cu4Js~f!.o'j
c.et vak.e;Set- v..we; exp.,&s"-tJ

>-:l

s-et

Pcvv~,r "ru
~
"'

oo.- ( vcJ.ce

~
..:;,

_1

S k'"'-la..av.,.

[ "

'i""'-c/

u Oo5 e

(Uri

r1fJ

:.. I

~J

-.- PY<IJ>'J
'Mmbe,- [ Rn (s 14,1-,

e.nv:'rD0oY>e.;J

-~

"'1

v~ ("" '?J

"""eJ.&j c~d Tf?~x-t/r:-

C""""'"'" J. ") ( AU. vf.. c

c.I'E}Jedbj e<k ( '' f'I1X> O!HZecav-hclj

ti

.>. e

( op j ~ ~-' f J Eo F J'nave .-.e).-/: )


0

<lhJ'lso

. c. J'g1e hi e J:- {_," s C.Yl p~~ .

?k .5_',1.S<Ie"l obje ctj {t -.-e~ bo I Jn../(reaJe TeA !J,'J-e} t.Jn'tcl;nidf'<Z<J T-fA/, bileA~d (,,

et'

ckz!'f,x u::t = crC'aJt 0,~- Pet ( ''fxce~ -Ap pL;


(JQ

(c)l.r->1 ' ) (

v;0,.~ If/CJc.rvhc)dij fldc{er) Gyf:.zt!' r1 c))'v-e S~-ep;)/ t. (ij(j

c
I

I)/- ,_L

(1)

_; // r-ou: ,

-...)

0
0

>-+,
~

00

/A c../-,v

&.Ju-f

c6/c:;r

hcoly' 5c~.to1J~~ ~

F,i~"f"?,~;-;

~nT!"mrrr

,"'~"~,,~~=""'"~""-""""T-~--~~n-lrr 1

r r

nm

~liveTech
fi<tlj

Wlinfl sofuti,,.,

Actions
Actions
> Action is a set of one or more script statements to perfonn a specific .task (or) Set of meaningful
Statements.
> It is a module which contains set of Script statements for a specific functionality of an Application
and it is integrated with Local Repository and Local Datasheet.
> When we select new test in QTP, by default "Action 1" will be available on QTP Test Pane which is
visible, but internally one more Action is maintained by QTP called "Action 0" in which the
execution is started and ended [just iike void main() inC Language].
> We can insert maximum of255 Actions in one single Test.

I
f

Benefits of Actions
> It increases Readability i.e. instead of reading the total script, we can read Action by Action.
> Debugging is very easy, i.e. we can find logical errors in the Script.
> Makes code Reusable.
> Scripts are easy to maintain.
> Scripts are efficient.
> Saves Development time.
Types of Actions
Three types of actions
1. Non-reusable action
An action that can be used only in the test in which it was created, and only once.
2. Reusable action
An action that can be called multiple times by the test in which it was created (the local test) as well
as by other tests.
3. External action
A reusable action called in another test.
External actions are read-only in the calling test. They can be modified only in the test in which they
were created.
Creating New Actions
1. Go to Insert menu> Click on call to New Action and observe Insert call to New Action dialog box
2. Enter Action name and description and Select Reusable Action if you want to make the action
reusable.
3. Decide where to insert the action and select "At the end of the test" or "After the current step" and
Click [OK]
Inserting Actions
You can insert an Existing Action in 2 ways

1. Insert call to Copy of Action


2. Insert Call to Existing Action

1. Insert call to Copy of Action


> Go to Insert menu and click on Copy of Action (or) right-click the action and select Insert
Copy of Action and observe Select Action window.
';;.- Select Test and Action name.
> Specify where to insert the action: At the end of the test (or) After the current step and Click
on (Ok].
> The actiop is inserted into the test as an independent, non-reusable action.
Mr.Venkat (Sr. Test Manager)

Page 71 of 118

-.,-

[------~~

t---

~liveTech
iktfy llslioR

sditti.>aJ

2. Insert Call to Existing Action


Pre Requisite:
The Action that you need to insert should be a reusable action.
~

Go to Insert menu and click on 'Call to Existing Action

In the Select an action box, select the action you WMt to insert from the list

Specify where to insert the action: At the end or after the current step and click on [OK]
The action is inserted into the test as a call to the original action

Dividing the Test into Two Actions


~ Select the step
~ Go to Edit menu click on Action> Split Action, (or) right-click the step and choose Action> Split.
~ Choose one of the following options:
Independent of each other. Splits the action into two sibling actions.
Nested (the second action is called by the first). Splits the selected action into a parent action
whose last step calls the second, child action.
Operations done on actions
~ Rename Action: Edit > Action > Rename Action
~ Delete Action: Edit > Action > Delete Action
~ Edit Action Properties: Edit > Action properties
Action Template
1. Whenever we are using Framework, the Script Template fields must be used by the Test Engineer for
all Actions.
2. To save the Time without writing Template fields for every Action manually, QTP provides a feature
called "ACTION TEMPLATE".
3. If we define the Template fields in Action Template, here onwards, Template will be available by
default for every new action.
4. Navigation:
Open Notepad and Define the Template fields like below:
'Project Code
'Project Name
'Created By
'Date Created
'Test case' Name
'Test Case Objective
'Expected Result

'*********************************************************************************
5.

Save the file as "ActiohTemplate.mst"(mst=module script template) in QTP -> "dat" folder.

Note:
1) ActionTemplate.mst is the standard name.
2) Double Quotes are important then only the Template can be seen for every action in QTP TestPane.

tt--

'

~.-

Mr.Venkat (Sr. Test Manager)

Page 72 of 118

~liveTech
t{y
fit

IWinB !ofti<>D!

CHECK POINTS
Types of Check Points:
1. Standard Check Point
2. Bit Map Check Point
3. Database Check Point
4. Text Check Point
5. Text Area Check Point
6. Page Check Point (For Web Pages only)
7. Table Checkpoint (Web Table)
8. Image Check Point
9. XML Check Point
10. Accessibility Check Point
1) Standard Check Point
We can use this check point to verify the property of an object.
E x: v enry
r u1pjda t e o r d er

Step Name
Step-1
Step-2
Step-3

Step description
Activate Window
Open Record
Perform change

Expected result
Disable
Disable
Enable

Actual

Status

Navigation
Start Recording 0 Click on "Ok" 0 Activate Window (Flight 4a.exe) 0 File Menu 0
Click on Open Order 0 Select Order No. 0 Enter No. 0 Click on Ok [] Perform any
chang~q Click Update Orde.rO Stop RecordingO K~th~application (Flight4a.exe) in base
state 0 Identify positions in the Test Script to insert Check Points [After Activate window;
after open order; after perform change] 0 Stmi Recording 0 {Inse1i Menu 0 Check Points
0 Click on
Standard Check Point} {or F12} 0 show object []with 0 Click Ok 0 Enter Name of the
Check Point 0 Select Property with expected value (Enable-True= Enable; Enable-False=
Disable)O Click Ok 0 Stop Recording after insertion of all Check points at relevant places
0 Click Run DAnalyze results manually.

Ex:l
Window("Flight Reservation") .Activate
Window("Flight Reservation").WinButton("Update Order"). Check CheckPoint("CP _1 ")
Window("Flight Reservation").WinMenu("Menu").Select "File;Open Order. .. ''
Window("Flight Reservation'').WinButton("Update Order").Check CheckPoint("CP _2")
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set
"ON" Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set "30"
Window("Flight Reservation") .Dialog(" Open Order"). WinButton(" 0 K ").Click
Window("Flight Reservation").WinRadioButton("Economy").Set
Window("Flight Reservation").WinButton("Update Order").Check CheckPoint("CP_3")
Window("Flight Reservation").WinButton("Update Order"). Click
,

~
r---lr-

[-I!

,-:_11

---Mr. Venkat (Sr. Test Manager)

Page 73 of 118

rc

i--------

.* liveTe.ch
filefy ltstinn so{n!WaJ

wait (10)
If Window("Flight Reservation").ActiveX("Threed Panel Control").GetROProperty("text")
="Update Done ... " Then
msgbox ("Test is pass")
else
msgbox ("Test is fail")
End If

How to edit existing check point:


Place the cursor on Check Point which you want to edit 0 Right Click 0 Check Point
Properties 0 Select property 0 Change value or Rename Check
Point 0 Click Ok.
How to insert check point through Active Screen
Start Recording 0 Record Required Operation like as below [Click on "Ok" 0 Activate
Window (Flight 4a.exe) 0 File Menu 0 Click on Open Order D Select Order No. 0 Enter
No. 0 Click on Ok 0 Perform any change D Click Qpdate Order] 0 Stop Recording 0
Keep the application (Flight4a.exe) in base state D Ide~y positions in the Test Script to
insert Check Points [After Activate window; after open or er; after perform change] D place
the cursor on specified statement 0 Click on Active Window D Right Click on object 0
Click on Insert Standard Check Point D Click Ok C Enter Check Point Name q Select
Property with expected value (Enable-True = Enable; Enable-False ~Disable) c: Select
option to insert statement (Before current Step I After cmTent Step) D Click Ok 0 Click Run
after insertion of all Che~k po~~~~ a~.Eeley~!!t p~~ces. 0 Analyze results manually.
--------------------fSac;.i)
~

. . . r:..,-- .

(l~~~~ ~--- _ _=1> ~,

- t

----~-~--

- . ---------

2) Bit Map Check Point


We can use this Check Point to conduct test on Bitmaps.
Navigation ,
Start Recording 0 Help Menu 0 Click on about D Inscn Menu (QTP) Check Point [l
{ti
Click Bit Map Check Point 0 Show Bitmap \Vith hand 1con
4. Click Ok 0 Enter Na_me of the Check Point J Click on select area if you want to check a
specific area with in the Bit Map CJ Select save only selected area D Click on Ok 0 Stop
Recording 0 Close current application (Fiight4a)
5. Open another application (Flight 4b) 0 Click run to analyze results manually.
How to insert check point through Active Screen
Start Recording 0 Help Menu 0 Click on about D Click on Bit Map [ Stop
Recording D Click on Active Screen Icon
Rjiit bck on Bit Map which you want to
check 0 Click on Insert Bitmap Check Point Click Ok 0 Enter Name of the Check Point
0 Select area which area to be checked ,J Select option to insert statement (Before current

=----

Mr.Venkat (Sr. Test Manager)

Page 74 of 118

L__

E ---.-:-

Step I After Current Step) 0 Click on Ok 0 Cdse current application (Flight 4a) 0 Open
another application (Flight 4b) 0 Click run to analyze results manually.

3) Database Check Point


To automate backend testing we are using DatabaseCheck Point. During this testing we
are validating backend table in tetms of Data validation and data integrity.
Data validation means that the correctness of stming values into backend table.
Data integrity means that the impact of stored values on existing data table content. In
this we will be concentrate on primary keys, foreign keys, unique keys, ....... etc.,
To automate backend testing we can follow below approach .

.~~~~~tl~-- . ..~==-::~==

....eo-----i

q:
'

,;;;r:
:-:.~'.'~. -~-illlU==~ ___ j
~
'f"~t:;':"S;,,;;;;oc<i''=~l

'.)

....
...

Actua
1 Data
Expected Value
==Fail
= ! Pass'

Step 1:
Step 2:
Step 3:
Step 4:
Step 5:

Corinect to Database using DSN (Data Source Name)


Execute Specified Select statement.
Retrieve the result of SQL Statement
Perform any db Operation.
Compare expected data with actual data to verify the impact of

r
-.'

"
E:------

~
-.~

frontend operation on backend table content.

,';

~
.f

Navigation

:----

Mr.Venk:at (Sr. Test Manager)

Page 75 of 118

:=--------

C=
~----,--

Insert Menu 0 Check Point 0 Database Check Point 0 Select "Specify SQL Statement
Manually" 0 Next 0 Create 0 Machine Data source (Select Data source) 0 Select DSN
(QT_FLIGHT32) 0 Click Ok 0 SQL Statement (Enter your specified SQL Statement Ex:.
select * from orders) 0 Finish 0 Change the Check Point Name 0 Click Ok 0 Open
Frontend (perform any db operation like insert, delete, update) 0 Click Run 0 Analyze
results manually.
To Create New DSN
*) First of all you create One database in MS Access with specified table.
Navigation
Insert Menu 0 Check Point 0 Click on Database Check Point D Select "Specify SQL
Statement Manually" 0 Next 0 Create 0 Machine Data source (Select Data source) 0 New
0 Select type of data source (User
[Single user] I System Data Source
[multiple users]) 0 Next 0 Select a
Regular Expression.
Driver (Microsoft Access Driver) 0
[A-Z] [a-z] [0-9]*
Select database 0 Click Ok 0 Enter
[A-Z] [a-z] [] [A-Z] [a-z]* [A-Z]
Data Source Name with description 0
[a-z]*
Click Ok 0 Click Ok D Take your
specified statement (Table) Ex:. select *
from orders) 0 Finish 0 Click Ok.
Note Database Check Point insertion is not possible through Active Screen.
4) Text Check Point
We can use this checkpoint to conduct test on text present on the object.
Navigation
Start Recording 0 Insert Menu J Check Point 0 Click on Text Check Point

1E Select object with hand icon C Clhk CJ Ok J Enter Name of the Check Point 0 Enter
your expected Text in 'Constant' [_i Select ~vfatching [(I) Match Case (2) Ignore Spaces (3)
Exact Match (4) Text Not displayed] [' Click on Ok
1E Stop Recording 0 Click run to analyze re3.1lts manually.
How to ins~rt check point through Active Screen
Start Recording 0 Activate WindoYv :- Stop Recording [ Click on Active
Screen Icon
ight click on object which object text :,;ou want to check 0 Select insert
Text Check Point 0 Click Ok -:= Enter Checkpoint Name J Expected text fill in 'constant' 0
Select Matching [(1) Match Case (2) Ignore Spaces (3) Exact Match (4) Text Not displayed]
0 Select Insert Statement (Before I After Cunent step) ~j Click Ok 0 Click nm to analyze
results manually.

1!--

r------ci

5) Text Area Check Point


We can use this Checkpoint to conduct test on Text present in the specified screen area.

t-

f
-r.g_

Navigation

r--- --Mr.Venkat (Sr. Test Manager)

Page 76 of 118

~UH~--

.*liveTech
fit=dyltslin1Js,,fJJril'llj

Start Recording 0 Insert Menu 0 Check Point 0 Click on Text Area Check Point 0
Select the area specified to check 0 Click Ok 0 Enter Name of the Check Point 0
Enter your ~xpected Text in 'Constant' or
click on to~e Regular expression 0 Select type of Matching [(1) Match Case (2)
Ignore Spaces (3) Exact Match (4) Text Not displayed] q Click on O~q Stop
Recordingq Click run to analyze result.srnanually.
Note: Text Area Checkpoint is not possible through Active Screen.

6) Page Check Point (For Web Pages only)


We can use this Checkpoint to verify the properties of a web page.
Navigation
Start Recording 0 Insert Menu 0 Check Point 0 Select Standard Checkpoint
lE Show Image I Link with Hand Icon 0 Select Page 0 Click Ok 0 Enter Name of the
Checkpoint 0 Select Property [give your expe.cted value (Load time, No. of Images, No of
links)] 0 Click Ok 0 Stop Recording 0 Click Run

lE Analyze Results manually.


7) Table Checkpoint
We can use this checkpoint to verify the content of a Web Table.
Navigation
Start Recording 0 Insert Menu 0 Check pait 0 Select Standard Checkpoint q Select Image
with Hand Icopq Clicl<C! Select Web Tabl~q Click O!<C~ Enter name of the Checkpoint 0
Select Cell 0 Enter your expected data in constant 0 Ciick Ok 0 Stop Recording 0 Run 0
Analyze Results manually.

L_
Ii

Note:
For Web Table
Browser("Browser Text Object Name").Page("Page Name").WebTable("Table
Name"). Check CheckPoint("Check Point Name")
For Page Check Point
Text
Object
Browser("Browser
CheckPoint("Check Point Name")

~"-,.-

Name").Page("Page

P.

Name'').Check

8) Image Check Point


To verify the properties of an Image, we can use Image
Check oint.
Browser("Browser Text Object Narne").Page("Page Name").lrnage("Image
Name'').Check CheckPoint("Check Point Name")
av1ga Ion
Start Recording 0 Insert Menu 0 Check point 0 Select Standard Checkpoint
lE Select Image with Hand Icon 0 Click 0 Click Ok U Enter name of the Checkpoint 0
Select Property (Alt) [give your expected value to that property]
lE Click Ok 0 Stop Recording 0 Run 0 Aalyze Results manually.

.or---

'

:
!!

,-,-

Mr.Venk:at (Sr. Test Manager)

Page 77 of 118

~liveTech
sofntions

lin(; Its linn

How can we check Tool Tips D Alt Property.

9) XML Check Point


To verify the content of an XML file we can use this check point.
Navigation
Insert Menu D Check point D XML Check Point (From File) D Browse your XML File ph
D Click Ok D Enter name of the Checkpoint D Select Element Name D Specify your
expected valueD Click Ok D Run D Analyze Results manually.

10)

Il----

Accessibility Check Point


We can use this checkpoint to verify whether the specified Web Page meets W3C
(WWWC) Standards or not (World Wide Web Consortium Standards)

Navigation
Tools Menu D Options. D Web Tab D Advanced D Select I Check in the check point
[ActiveX Check, Alt Property Check, Applet Check, Frame Titles Check, Multimedia Links
check, Server-side Image Check, Tables Check] D Ok D Ok D Start recording 0 Insert
Menu D Check Point 0 Click on Accessibility Check Point 0 Show Web Page with Hand
Icon 0
Click 0
Ok q Enter Name of the Checkpoi11tO Click Ol<O Stop
Recordingq Rupq Analyze Results manually.
Note
Page Checkpoint, Table Checkpoint, Image Checkpoint, Accessibility Checkpoint, XML
Checkpoint are applicable for Web Pages only.

it-----

Mr.Venkat (Sr. Test Manager)

Page 78 of 118

~liveTech

firtfj Its tin,q sofnticJIH

Recovery Scenario Manager (Folder 6)


~

To recover from unexpected events and errors that are occurred in the test envirorunent
during run session, we can use Recovery Scenario Manager.
~ For good recovery, error must be known the occurrence is unknown.
There are four types of events such as
1. Application Crash
2. Popup Window
3. Test Run Error
4. Object State
1. Application Crash
An open application fails during Test Run.
Navigation
);> Resources Menu ->Recovery Scenario Manager
);> Click New Scenario-> Next ->Select "Application Crash" as Trigger event->Next
);> Select "selected executable application"->Next ->Next ->Select Recovery Operation
[Keyboard, Mouse Operation, Close Application Process, function Call, Restart,
Microsoft Windows]
);> Next ->Ifyou want to check Add another operation else uncheck->Next->Next->Enter
Scenario Name->Next->Finish ->Close
);> Save the scenario in specified location with ' .qrs"
);> qrs stands for "QuickTest Recovery Scenario".
Result:
Trigger Event:
Application crash
/
Recovery Operations:
Restart Microsoft Windows
Post-Recovery Test Run Options:
Restart current test run
2. Popup Window
~ To handle unwanted POP UP's.
);> An open application fails during Test Run.
Navigation
);> .Resources Menu ->Recovery Scenario Manager ->Click New Scenario-> Next ->Select
"Popup Window" as Trigger event->Next
);> Cljck on Hand Icon->ShO\v unwanted window with Hand icon ->Next ->Select function
call as Recovery Operation ->Next [Open Notepad ->Sc:ve empty file with .vbs
extension]
~ Browse the .vbs fie path ->Next ->Uncheck Add another Recovery Operation ->Next->
Select Post-Recovery Test Run Option [Repeat current step and continue] ->Next ->Enter
Scenario Name ->Next ->Finish
);> Save the scenario in specified location with ".qrs"
~ Record required Recovery Operation (Click [OK] , Click [Cancel] on POP UP) take the
script into function
);> Save the library file ->Click Run

Mr.Venkat (Sr. Test Manager)

Page 79 of 118

..... ?>:.

~--

f-=----=--=----=
~

t--

~
I,

~liveTech
firefy wlinn solittiou
3. Test Run Error
A step in your test does not run successfully then Test Run Error can be raised.
Navigation
~ Select Next 0 New 0 Recovery Scenario Manager 0 Resources Menu 0 select any
error Next 0 "Testrunerror Window'; as Trigger event 0 o Next Select function call as
Recovery Operation 0 Next 0 Next 0 D 0 Browse the Save empty file with .vbs
extension] 0 [Open Notepad 0 Next Uncheck Add another Recovery Operation 0 Next
0 .vbs fie path 0
~ Select Post-Recovery Test Run Option [Repeat current step and continue, Proceed to
Next step, Proceed to Next Action, Proceed to next test iteration, Restart current test run,
Stop the Test Run] Select Option DFinish Next [J Enter Scenario Name 0 Next 0 0
~ Record required Recovery Operation Save the scenario with ".qrs" 0 [Click ok, Click
Cancel] take the script into function
? Click Run Save the library file 0
4. Object State
The property values of an object in your application match specified values. You can specify
, property values for each object in the hierarchy.
Navigation
>- Resources Menu 0 Recovery Scenario Manager D New 0 Next 0 Select "Object state
\Vindow" as Trigger event 0 Next 0 Click on Hand Icon 0 Show object with hand icon
0 Next 0 Next->select object property with value (enabled ,false)->click next 0 Select
function call as Recovery Operation [] Next [Open Notepad 0 Save empty file with .vbs
extension] fJ Browse the .vbs fie path c:: Next 0 Uncheck Add another Recovery
Operation D Next 0
;;;, Select Post-Recovery Test Run Option [Repeat current step and continue, Proceed to
Next step, Proceed to Next Action, Proceed to next test iteration, Restart current test run,
Stop the Test Run] 0 Next [j Enter Scenario Name 0 Next 0 Select Option DFinish
> Save the scenario with .qrs" ~~ Record required Recovery Operation [Click ok, Click
Cancel] take the script into function
;- Save the library file iJ Click Run

Output Values
~

It is a step in which one or more values are captured at a specific point in the test.
> En3blcs to choose which property values to output
Types of Output Values
Standard Output values
a
Text Output values
Text area outpur value
Database output value
XML output value
While Recording
Choose Insert> Output Value. (Or) Insert Output Value button on the toolbar
\Vhile editing your test
Right-click on the object in the Active Screen and choose Insert Output Value. (or) right-click
the step and choose Insert Output Value.
111

~-----

Mr.Venkat (Sr. Test Manager)

Page 80 of 118

.''r
,.

if!
I

Regular Expressions

Whenever the object text is changing dynamically at run time, we can use regular
expresswns.
If property value is changing during each run session, use regular expressions when defining
or parameterizing property values
In standard checkpoint the expected value of an object's property can be set as a regular
expression so that an object with a varying value can be verified
Example: When creating a standard checkpoint to verify the property values of an object, you
can set the expected value of an object's property as a regular expression so that an object with a
varying value can be verified

Regular Expressions Pattern


Backslash Character ( \ )
Match any Single Character ( . )
Match any Single Character in a List ( [.xy] )
Match any Single Character Not in a List ( ["xy] )
Match any Single Character within a Range ( [x-y] )
Match Zero or More Specific Characters ( * )
Match One or More Specific Characters ( + )
Match Zero or One Specific Character ( ? )
Grouping Regular Expressions ( ( ) )
Match One of Several Regular Expressions ( I )
Match the Beginning of a Line ( " )
Match the End of a Line ( $ )
Match Any AlphaNumeric Character Including the Underscore ( \w)
Match Any Non-AlphaNumeric Character ( \W)
Combining Regular Expression Operators

Virtual Objects

>>-

Virtual objects enables to record and run tests on objects that are not normally recognized by
Quick Test.
QTP'is failed to recognized application object, Go for Virtual Object.

Using the Virtual Object Wizard


Mapa virtual object to a standard object class such as a button or a check box.
Specify the boundaries & the parent of the virtual object
Assign it a name.
You can group your virtual objects logically by assigning them to collections.

Mr.Venkat (Sr. Test Manager)

Page 81 of 118
~

f--

---

At liveTech

liulj ttslilg scr.IW.,

Test Batch Runner

>-

In my current project we used two methods to execute the Scripts.


1. Batch Processing
2. Using Framework - AOM
1. Batch Processing
Purpose of Batch Mode in QTP:
In order to run test cases/test scripts which have same related functionality as a group
In order to reduce the regression testing effort as we test specific group of test scripts
which have same related functionality when a single test case in that particular group
fails, Instead of going for regression on all the test cases which are available
In order to run many tests at a time as a group we use Batch mode.
Pre requisites:
Before going for batch processing we have
To follow the below steps:
>- Go to Tools menu --> Options-7 Select Run tab-7 Select Allow other HP Products to run
tests and components and Click on [OK]
Steps to work with Batch runner:
> Start-7 Programs-7 QTP-7 Tools-7 Click on Test Batch Runner and Observe Test Batch
Runner window
>- Go to Batch menu and click on ADD-7 Browse and select the related Test Scripts which
need to run in Test Batch Mode
Saving the Batch scripts:
,_ We have to save the scripts which were added into the batch mode with proper Naming
conventions and ".MTB" (modular Test Batch) extension.
This is the way we create various Batches for regression testing.
Running the Test scripts in Batch mode:
> Go to Batch menu-7 Click on RUN
r Check the behavior of your application
> Observe Test Results Summary window
> If any Failures or Warnings, Report it as a Defect using Quality Center 10.0 I Bugzilla

~--

Automation Object Model (Folder 7)


To pre-configure QTP Test settings, we can use Automation Object Model
Open Notepad prepare the script like as below and save the file with *. vbs extension

Set q tp=Createobject(" QuickTest.application ")


qtp.launch
qtp. visible=True
qtp.Showpanescreen "DataTable" ,False
qtp.Showpanescreen "DebugViewer" ,True
qtp.Showpanescreen "ActiveScreen" ,True
qtp.open "E:\Linear\Test_Login"
qtp.test.run
qtp.open "E:\Linear\Test_Update"
qtp.test.run
qtp.quit

~---=----

Mr.Venkat (Sr. Test Manager)

Page 82 of 118

,_:_

L
~

QuickTest Script Editor

>

>>

The QuickTest Script Editor is a tool that enables you to open and edit multiple test scripts
and function libraries simultaneously.
You can also create new function libraries.
You can modify the script of a test, but you cannot create new tests, associate or remove
associated function libraries, or change information such as existing test names, test settings,
parameterization, or Data Table values.

~--

Navigation:
Start> Programs >QuickTestProfessional > Tools> QuickTest Script Editor.

El

L .. ~. Reb.Jrntbrnc

.Jli] l.olercur~T outs

: ....~ Sgn_in [Ac.tionA]

i -~ copy of Fltgt"I:O'der
!... ~ RebJrroH::>rne [Action:,)

ft"ID

Rc;;~Expcs~i:m

: ' " A::tbnl

?7t-rr.--.~""' er('\Nelcom(l:

IAorcury Tours

"'"''-:r.-. M"er('\IYelo::nne: MercuryTours


v.,ut->rr""'"' er('\Nel corn e: l,,j e rcury Tours
u?&4--io.-""''"' erf'Viel o: me: 1-,1 e rcur.t Tout's

..c~-a,n.;. ,r::: er(''v'/elo::me: f.Aercu~. Tours


,z;.<:t-;rrr.vr: cr('Vv'olcomo: 1-Aorclny Tours
er('\l'leloorne:

Display area

-.;;r-----------

Resources
pane

t..~1ercuryTours

er('V"iel DJ rn e: fv"1 e rcur.:/ Tour:;


5 er('Vi el con, e: lr1 e rcur::/ Tours

er('VieloJme: tr1ercuryrours

Flow pane

The QuickTest Script Editor window contains the following key elements:
Flow Pane:
~ Displays the flow of the action calls for each ofthe open tests.
Resources Pane:
~ Displays the open tests, its local actions and any function libraries associated with each
test, as well as a list of all currently open function libraries.
Display area:
~ Displays a window for each of the open tests and function libraries.

Mr.Venkat (Sr. Test Mnnager)

Page 83 of 118

;,
~.-

.r----

~---

r~

Step Generator (F7)


~ It is used to generate steps in the Test pane without click on start Recording.
~ Step Generator consists of statements in three categories such as
1. Functions
(Built-In,Library ... )
2. Utility objects (Systemutil, Datatable ... )
3. Test Objects (Test Operations like Set, Click, GetROProperty ... )
1. Functions
~ This category specifies all general and mathematical operations such as left, right, len, time,
cint, cdbl, cstr, ltrim, rtrim, trim etc.,
2. Test Object
~ This category specifies the operations which are performed on the objects such as Set,
Select, Activate, SetSecure, Click, GetVisibleText, GetROProperty, GetTOProperty,
Getltem, GetltemCount, GetContent .... Etc.,
3. Utility Objects
~ This category specifies all miscellaneous operations such as DataTable Operations,
SystemUtil Operations, QCUtil Operations, Recovery Operations etc.,

I--

._~~

lvlr.Vcnkat (Sr. Test Manager)

Page 84 of 1 IS

!l' i

~liveTech
fiNly Wlinfl scfulions
Automation Framework
~
~
~

Automation Frame work is nothing but an Automation planning for the project which is
prepared by Test Lead.
It helps to control the automation .project in a better way.
In my current project, we are using "Hybrid framework" which is prepared by my Test
Lead (But, we customized the framework as per our project needs).

Automation Frame work contains:


~ What functionalities to be automated
~ What Approach to be followed
~ What levels we have to use in order to develop the scripts (either it is Record I Actions I
VB script I Functions I Descriptive Programming I Step Generator I Drag and Drop)
);> What naming conventions to be followed
~ Where to store the scripts
);> Calling the scripts
~ Directory structure Qf automation
);> Where to store the Test results
-:-:> sd~ re_
_;../ ~ 6t.tr C..QJ.
Types of FrameworK
1. Linear Framework
2. Modular Framework
3. Data Driven Framework
4. Keyword-Driven Framework
5. Hybrid Framework
1. Linear Framework
> Without using any functions, reusable Actions, we are going to write the script called
Linear Framework
> There is no Reusability.
> In this Framework we are preparing script for scenarios using Record and Playback
method
Navigation:
;;- Record required operation 0 Enhance Test Script as per Scenario 0 Save test 0 take the
help of Test Batch Runner Tool to execute group of tests sequentially
2. Modular Frame,vork
> Going to write scripts module wise
> Every operation we have to cover in our script by using reusable actions or functions
);;> We should maintain function calls for navigating the whole test case
> In this framework we are preparing script for scenarios using Reusable components I
Reusable Actions.
> When client asks we don't want all script, we need only function calls, then we go for
Modular Framework
> Code hiding is there, by calling all scripts in one script, we are hiding code

Mr.Venkat (Sr. Test Manager)

Page 85 of 118

.-"

,-.- -

a-'~

Navigation:
Record required repeatable operations 0 Save them in a specific location as reusable action 0
Prepare script for scenarios using those reusable actions 0 Save them 0 Take the help of Test
Batch Runner Tool to execute group of tests sequentially.

J-

3. Data -Driven Framework


> Data is running or Driving the whole test cases is called Data Driven Framework
> If 80% of the scripts have test data to automate, we go for Data Driven Framework
> We have to store all "test data" in one folder and retrieve the "Test data" whenever we
need in script
4. Key-Word driven Framework
> In this framework we are preparing script for scenario using functions and driven, the
script with keywords.
5. Hybrid Framework
> Combination of all above called Hybrid Framework
In my current project Automation Testing Process started with three Stages
2. Tool Evaluation
- Stage 1
7.
8.
9.
10.
11.

Analyzing the Test cases


Preparing Analysis sheet
Estimating script development time
Sending summary sheet for Approval .
Confirmation

16.
17.
18.
19.
20.
21.
22.
23.
24.

Automation Folder ~~ructure Preparing


Preparing Object Repository

Creating re-usable components and functions
Creating scripts and Enhancing scripts
Dry run
Final Execution
Peer Execution
Delivery of scripts
Enhancements

-Stage 2

r1

_.

~r---

f
!~

~.,

-Stage 3

"
b_;_
r,-

1. Tool Evaluation
> In first stage we evaluated commercial and open source test automation tools (QTP and
Selenium)
> After initial evaluation with our project 25 features, we finalized QTP
2. Analyzing the Test cases
.
> In Second stage, we analyzed arid understanding project test cases
> Getting Knowledge Transfer from manual Test Engineers

;;---

Mr.Venkat (Sr. Test Manager)

Page 86 of 118

3. Preparing analysis sheet


.)> After analyzing the test cases prepared analysis report for test cases to be automated and
not to be automated
4. Estimating script development time
.)> Estimating script development time
5. Sending summary sheet for approval
~ Sending automation test case summary sheet for approval
6. Confirmation
~ Approval from Client or Manager

Key-word Driven Framework Implementation


I

In my current project we followed Key-word driven framework follows ...


'

'

1. Ickatified three scenarios for automation


1. Login into application
2. Insert Order
3. Update Order
2. Folder Structure Preparation

I
~

II
l

3. Four functions are developed


1. Login
2. lnsert order
3. Update_order
4. Close_App
'*************************** Login Function ***********************************
'Function Name
:Login
'Function Description
: It is used to login application
'Parameters
: strUrl, strUid, strPwd
'Date Created
: 23-Mar-2012
'Created by
: Venkat

-':_I

'****************************************************************************
Function Login(Byval strUrl,Byval strUid, Byval strPwd)

Mr.Venkat (Sr. Test Manager)

Page 87 of 118
f---

-*liveTech

L
f ..

fkefy tiiiisflliiiIW.,

Systemutil.Run strUrl
Dialog("Login ").Activate
Dialog("Login").WinEdit("Agent Name:").Set strUid
Dialog("Login").WinEdit("Password:").Set strPwd
Dialog("Login").WinButton("OK").Click

l---

IfWindow("Flight Reservation").Exist Then


Reporter.ReportEvent micPass,"Login","Login Successfull"
Login="Pass"
Else
Reporter.ReportEvent micFail,"Login","Login Unsuccessfull"
Login="Fail"
End if
End Function

'****************************Insert Order*************************************
'Function Name
:Insert Order
'Function Description
: It is used to verify Order
'Parameters
: dtDate,strFly_From,strFly_To,intTof, strName, intTic
'Date Created
: 23-Mar-2012
'Created by
: Venkat
'*****************************************************************************
Function Insert_Order(Byval dtDate,Byval strFly_From,Byval strFly_To,Byval intTof,Byval
strName,Byval intTic)
Window("Flight Reservation").WinMenu("Menu").Select "File;New Order"
Window("Flight Reservation'').WinObject("Date of Flight:"). Type dtDate
Window("Flight Reservation").WinComboBox("Fly From: ").Select strFly_From
Window("Flight Reservation").WinComboBox("Fly To:").Select strFly_To
Window("Flight Reservation").WinButton("FLIGHT").Click
Window("Flight Reservation").Dialog("Flights Table"). WinList("From").Select intTof
Window("Flight Reservation").Dialog("Flights Table").\VinButton("OK").Click
Window("Flight Reservation'').WinEdit("Name: ").Set strName
Window(" Flight Reservation"). WinEdit("Tickets: ").Set intTic
Window("Flight Reservation").WinButton("Insert Order").Click
wait(IO)
strMsg = Window("Flight" Reservation"). WinObject("Insert Done").GetROProperty("text")
If strMsg="Insert Done... " Then
Reporter.ReportEvent micPass,"InsertOrder","Insert Order Done Successfully"
Insert Order="Pass"
Else
Reporter.ReportEvent micFail,"InsertOrder","Insert Order Failed"
Insert Order="Fail"

Mr. Venkat (Sr. Test Manager)

Page 88 of 118

8..__._

..

I;
~
~

II

i
~

~:~-

,.

I
I

'

1
I

I
~

;;---

.* liveTech
fiNly ltJiiniJ JOf#Mnl

I
I
I

l
I
j

End If
End Function
'**************************** Update_Order ***********************************
'Function N arne
: Update_Order
'Function Description
: It is used to very Update Order
'Parameters
: intOrder,strName
'Date Created
: 23-Mar-2012
'Created by
: Venkat
'****************************************************************************
Function Update_Order(Byval intOrder,Byval strName)
Window("Flight Reservation").WinMenu("Menu").Select "File;Open Order... "
Window(" Flight Reservation ").Dialog("Open Order"). WinCheckBox("Order No. ").Set ON
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set intOrder
Window("Flight Reservation ").Dialog("Open Order"). WinButton("OK"). Click
Window("Flight Reservation"). WinEditC'Name:").Set strName
Window("Flight Reservation"). WinButton("Update Order"). Click
strMsg = Window("Flight Reservation").WinObject("Undate Order").GetROProperty("text")
If strMsg="Update Done... " Then
Reporter.ReportEvent micPass,"Update Order","Update done successfully"
Update_Order="Pass"
Else
Reporter.ReportEvent micFail,"Update Order","Update Failed"
Update_Order="Fail"
End If
End Function
'**************************Close_App*****************************************
'Function Name
: Close_App
'Function Description
: It is used to Close the application
'Parameters
:- NA'Date Created
: 23-Mar-2012
'Created by
: Venkat
'*****************************************************************************
Function Close_App()
Window("Flight Reservation").Close
If not Window("Flight Reservation ").Exist(l 0) Then
Reporter.ReportEvent micPass, "Close app", "Application closed
successfully"
Close~App="Pass"
Else
Reporter.ReportEvent micFail,"Close app","Application not closed"
Close_App="Fail"
End If
End Function
'*****************************************************************************
4. Library

Mr.Venkat (Sr. Test Manager)

~.

f.

tr

J'

!:!.________

I ~r
~

'

:-:.~-

IT

Page 89 of 118

.~

All four functions copy into Notepad and Save it as .vbs extension
);> Copy the functions file into "Library" folder
Object Repository
);> Object Repository creation for application
);> Go to Resources~ Object Repository~ Add Objects to Local
);> Export these repository into "Object Repository" folder
Environment
);> Environmental variable creation
);> File~ Settings~ Environment~ User defined~ Add~ Enter Name as uri~
Enter Value as "uri of application"~ [OK]
);> Export user-defined environment variables to an XML file into "Environment"
folder
Recovery Scenario
);> Resources ~ Recovery Scenario Manager~ New Scenario icon ~Next ~
Select event
);> Save recovery Scenarios into "Recovery Scenario" folder
Test Data
);> Create input.xls file and save it into "Test Data" folder
);> Create three worksheets
1.
Module
2.
Test Cases
3.
Test Steps
1. Module
);>

5.

6.

7.

8.

Moduleld
IModuleNarne ModuleExe ;
M1
!Admin
Y
-l
~----------+-------------~-------------1
M2
!Customer
N ......_____________.
L--.-.-----------'-------------'-----'"
2. Test Cases

3. Test Steps:

J~~-t?.?. _jgJq?.~_APP . . . . !ca


tc03 ts1 ilogin

lin
:uo

tc03 ts3 !Close App

iCa

~~q~=~?.l..J!-:lP99!~_Qr9~r

Mr.Venk:at (Sr. Test Manager)

Page 90 of118

t ---

I
I

~liveTech
filot/jltstillJisdltWiu
9. Test Script
10. Write Driver script
11. All files need to associate with script
)> Library
File ~Settings ~Resources ~Add
)> Environment Variable
File ~Settings~ Environment ~User Defined~ Load
)> Recovery Scenario
File ~Settings ~Recovery ~Add
)> Repository
Resources ~Associate Repository ~Add

Driver Script
*****************************************************************************
Project Code
: LT- 333
1
Project Name
: Flight Application
1
Created By
: Venkat
1
Date Created
: 24-Jan-2011
1
Test case Name
: Flight Application Home page
1
Test case Objective : Verify Login, Insert Order and Update Order
1
Expected Result
: Ordets should be Inserted and updated successfully
'**********************************Variable Declaration*************************
Option Explicit
Dim Mcount, Mexe, Moduleid, Moduleid1, Tcount, res, Keyword, Tscount Tcid, Tcid1, i,j, k
**********************Functional Scenario**************************************
'Adding sheet to runtime Data Table
Datatable.AddSheet ("Module")
Datatable.AddSheet("Testcase")
Datatable.AddSheet C1Teststep")
'Importing Sheets from an External Excel File
Datatable.ImportSheet "C:\Flightresrvation\Testdata\Input. xis", 1, "Module"
Datatable.lmportSheet "C :\Flightresrvati on\Testdata\Input.xls" ,2, "Testcase"
Datatable.ImportSheet "C:\Flightresrvation\Testdata\lnput.xls",~,"Teststep"
Mcount=DataTable.GetSheet("Module").GetRowCount
For i= 1 to Mcount step 1
Datatable.SetCurrentRow(i)
1

. :\

. ~

Mexe=Datatable.Va!u~{3,"Module") ~~,(,~, s,he.Q.:h-Jc~)

I
I

Ifucase(Mexe)="Y" Then
Moduleid=Datatable. Value(1, "Module")
Tcount=Datatable. GetSheet("Testcases"). GetRowCount
For j=l to Tcount step 1
Datatable.SetCurrentRow (j).

T~=DataTable.Value(3,"Testcases 11 )
Moduleid1 =DataTable.Value(4, "Testcases")

i'

I"

IfModuleidl= Moduleid and ucase(T~="Y" Then


Tcid=Datatable.Value(1,"Testcases 11 )
Tscount=Datatable. GetSheet("Teststeps "). GetRowCount
For k=l to Tscount step 1
Datatable.SetCurrentRmy(k)
Tcidl =Datatable.Value(5,"Teststeps")
IfTcid1=Tcid Then

Mr.Venkat (Sr. Test Manager)

r'
~.

B -,-

~! ~

Page 91 of 118

r--

Keyword=Datatable.Value(3,"Teststeps")
Select Case Keyword
Case "In"
res= Login( environment. Value("url "), "venkat", "mercury")
Datatable.Value(4, "Teststeps")=res
Case "ca"
res=Close app()
Datatable.Value(4,"Teststeps")=res
Case "ins"
res=insert_order("090911 ","Denver","London",l,"John Gun","2")
Datatable. Value(4, "Teststeps")=res
Case "uo"
res=Update_Order("2","John Nithu")
Datatable. Value(4, "Teststeps")=res
End Select
End If
Next
End If
Next
End If
Next

I-

'Export Results to 'TestLog' folder


Datatable.ExportSheet "C :\Flightresrvation\TestLog\Result.xls", "T eststeps"
10. Test Run
~ Create AOM.vbs and Save into "TestRun" folder.
Set qtp=CreateObject("Quicktest.Application")
qtp.Launch
qtp. visible=True
qtp.open "C:\Flightresrvation\Testscripts\Driverscript"
qtp.test.run
qtp.quit
11. Execution:
~ Go to Test Data Folder, In "input.xls" sheet mark to "Y" (yes) of the Module, Test cases
which are need to execute in current build
~ Go to Test Run Folder and click on AOM.vbs file
~ Observe-Test log Folder for results
.................._.....,_ ___

"~

Teststeps
tcOl ts1
tc01 ts2
tc02 ts1
tc02 ts2
tc2 ts3
tc03 ts1
tc03 ts2
tc03 ts3

1Function

Name

iLogin
!Close App
!Login
!Insert Oder
!Close App
iLoqin
\Update Order
\Close App

K~ord

In
ca
In
ins
lea
In
uo
ca.

:Result
'Pass
!Pass
Pass
'Pass
!Pass
:Pass
.Pass
Pass

,.,~

'Testcaseld ;
'
'tc01
i
I
:tc01
I
tc02
t
tc02
tc02
i
I
tc03
i
tc03
tc03
---

:_____ ____

Mr.Venkat (Sr. Test Manager)

Page 92 of 118

:~

--

Data Driven Framework Implementation


1. Folder Structure Preparation

5I

fl ,~tpi~~;

10 Environment
IQ library
~Recovery
~::;, Repository
Q Test Data

fO'Test Log,'

e.;, Test Run

ra;a Tes~'Scrfpt:
2. Object Repository
~ Object Repository creation for application
~, Go to Resources -7 Object Repository -7 Add Objects to Local
~ Export these repository into "Object Repository" folder
3. Environment
~ Environmental variable creation
~ File -7 Settings -7 Environment -7 User defined -7 Add -7 Enter Name as uri -7
Enter Value as "url of application" ,-7 [OK]
~ Export user-defined environment variables to an XML file into "Environment"
folder
4. Recovery Scenario
~ Resources -7 Recovery Scenario Manager -7 New Scenario tcon -7 Next -7
Select event
~ , Save recovery Scenarios into "Recovery Scenario" folder
5. Test Data
> Create input.xls file and save it into "Test Data" folder
6. Test Script
~ Write Driver script
~ All files need to associate with script
1. Environment
:File-7 Settings-7 Environment-7 User Defined -7 Load
2. Recovery Scenario: File -7Settings -7 Recovery -7 Add
3. Repository:
Resources -7 Associate Repository -7 Add

*****************************************************************************
1

Project Code
: LT 333
Project Name
: Flight Application
1
Created By
: Venkat
1
Date Created
: 23-Mar-2012
1
Test case Name
:Flight Application
1
Test case Objective: Verify Calculation Test
1
Expected Result
: Calculation must be happen as per FRS
1

~----

11

,-,~

I*****************************************************************************
Mr.Venkat (Sr. Test Manager)

Page 93 of 118
[
~

l==
_I_

Option explicit
Dim Row_Count,i,Order_ Number,Tic,Price,Prc, Total, Tot
DataTable.AddSheet ("Input")
DataTable.AddSheet("Output")
DataTable.GetSheet("Output").AddParameter "Tickts",""
DataTable.GetSheet("Output").AddParameter "Price",""
DataTable.GetSheet("Output").AddParameter "Total",""
DataTable.GetSheet("Output").AddParameter "Results",""
DataTable.ImportSheet "D:\\Testdata.xls",l, "Input"
Row_ Count=Datatable.GetSheet("Input").GetRowCount

f
J

For i=l to Row_Count step 1


Datatable.SetCurrentRow(i)
Order_Number=Datatable. Value("Ordemumber", "Input")
Window("Flight Reservation").Activate
Window("Flight Reservation"). WinMenu("Menu").Select "File; Open Order... "
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set "ON"
Window("Flight Reservation").Dialog("Open Order"). WinEdit("Edit").Set Order_Number
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click
Tic= Window("Flight Reservation").WinEdit("Tickets:").GetVisibleText()
Price= Window("Flight Reservation").WinEdit("Price:").GetVisibleText()
Prc=mid(Price,2,len(Price)-1)
Total= Window("Flight Reservation").WinEdit("Total:").GetVisibleText()
Tot=mid(Total,2,1en(Total)-1)
If cdbl(Tot)=cdbl(Prc)*cdbl{Tic) Then
Reporter.ReportEvent micPass,"Calculation Test","Test is Pass"
Datatable. Value("Tickts", "Output")=Tic
Datatable.Value("Price", "Output")=Prc
Datatable.Value("Total ", "Output")=Tot
Datatable.Value("Results","Output")="Test is Pass"
Else
Reporter.ReportEvent micFail,"Calculation Test'',"Test is Fail"
Datatable. Value("Tickts", "Output")=Tic
Datatable.Value("Price", "Output")=Prc
Datatable.Value("Total","Output")=Tot
Datatable.Value("Results","Output")="Test is Fail"
End If

Next
Datatable.ExportSheet "D:\OutputSheet.xls","Output"

*****************************************************************************
7. Test Run
)>

Create AOM.vbs and Save into "TestLog" folder.

8. Execution:

lt------

Go to Test Data Folder, In "input.xls" sheet mark to "Y" (yes) of the Module, Test cases
which are need to execute in current build
- )> Go to Test Run Folder and click on AOM.vbs file
)> Observe Test log Folder for results
)>

-'-

~---

Mr.Venkat (Sr. Test Manager)

Page 94 of 118

L_ __ _

'~

Web Programming I HP QC I Interview Questions


Script 1:
How to close Pop ups during Run time
a=lO
b=20
Set ObjShell=CreateObject("wscript.shell")
If b=a+ 10 Then

objShell.popup "b is equal to a", 2 (Time in Seconds)


else
objShell.popup "b is not equal to a", 5
End If
Script 2:
How to delete cookies
Systemutil.Run "iexplore", "www.google.com"
wait(5)
webutil.DeleteCookies
systemutil.CloseDescendentProcesses

Script 3:
How to close all the browsers
Set objDesc=Description. Create
objDesc.Add "micclass","Browser"

set objColl=Desktop.ChildObjects(objDesc)

1-

,r

msgbox objColl.count
For i=O to objColl.count-1 step 1
BrN ame=objColl( i). GetropropertyC'name")
Msgbox BrName
objColl(i).close

"

tf-----

c!

Next
Script 4:
'How to close all t.b.e browsers except our specified browser
Option explicit
Dim objDesc,objColl,BrName,i
Set objDesc=Description.Create
objDesc.Add "micclass ","Browser"
Set objColl=::::Desktop.ChildObjects(objDesc)
For i=O to objColl.count-1 step 1
BrN ame=objColl(i). GetRoProperty("name")
IfBrName="Google" Then
'Dont do anything
Else

Mr.Venkat (Sr. Test Manager)

~7

Page 95 of 1 1

f7

objColl(i).close
End If
Next
Script 5:
How to close all items in Desktop except QTP
Set objDesc =Description. Create
objDesc("micClass").Value ="Browser"
Set objBrs = Desktop.ChildObjects(objDesc)
Fori = 0 to objBrs.count-1
strBrName=objBrs(i).GetROProp~rty("name")

If strBrName <> "QUICK TEST PROFESSIONAl}' Then


objBrs(i).close
End If
Next

Script 6:
How to count number of links in a specified web page
Set oDesc=Description.Create
oDesc.Add "micclass", "Link"
Set objColl=Browser("title:=Google").Page("title:=Google").ChildObjects(oDesc)
For i=O to objColl.Count-1 step 1
LinkName=objColl(i).GetRoProperty("name")
Print LinkName
Next

Script 7:
'How to count no of links in a specified web page and how to display their names one by
one into notepad
Option explicit
Dim objDes,opjColl,objFso,objf,i,link_name
Set objDes =description.Create
objDes.Add "micclass","Link"
Set objFso=createobject("scripting.tilesystemobject")
s.et objf=objFso.CreateTextFile("D:\linknames.txt")
. set objColl=Browser("title:=. *").Page("title:=. *").ChildObjects(objDes)
For i=O to objColl.count-1 step 1
link_name=objColl(i).getroproperty("name")
objf.WriteLine link name
Next
objf.Close
Set objFso=nothing

o--

"-----

t-~----

Mr.Venkat (Sr. Test Manager)

Page 96 of 118

r-

~:~

I
j

rt

Script 8:
How to Set link names one by on into Excel
Option explicit
Dim objExcel,objSheet,objWbook,objCell,i,Link_Name,objColl,objDesc
Set objExcel=CreateObject("Excel.application")
objExcel. Visible=True
objExcel. W orkbooks.Add
Set objSheet=objExcel.ActiveSheet
objSheet.cells(l, l)="LinkNames"
Set objCell=objSheet.cells( 1,1)
objCell.Font.color=Vbblue
Set objDesc=Descrip.tion.Create
objDesc.Add "micclass", "Link"
Set objColl=Browser("title:=. *").page("title:=. * '').ChildObjects(objDesc)
For i=O to objColl.count-1 step 1

Link_Name=Browser("title:=. * ").page("title:=. * ") .link("index :=" &i) .getroprop~S:rty("name")


objSheet.cells(i+2,l)=Link Name
Next
Set objWbook=objExcel.ActiveWorkbook
objWbook.SaveAs "F:\Results.xls"
objExcel. Quit
Set objExcel=Nothing

Script 9:
How do we validate links in web page and how to display link names with status in excel
Set objExcel=Createobject("excel.application")
objExcel.Visible=True
objExcel. Workbooks.Add
set objSheet=objExcel.ActiveSheet
objSheet.Cells(1,l)="LinkName"
objSheet.Cells(1,2)="Expected URL"
objSheet.Cells(1,3)="Actual URL"
objSheet.Cells(1,4)="Status"
Set objDesc=Description.Create
objDesc("micclass "). value="Link"
set objLinks=Browser("title:=. *").page("title:=. *").childobjects( objDesc)
msgbox objLinks.count

,-,2------

For i=O to objLinks.count-1 step 1


strLinkName= Browser("title:=. *").page("ti tie:=. *").L i nk("name:=. *","index :="&i}.Getroproperty("name")
strExpUrl=Browser("title:=. *").page("title:=. *").Link(" name:~.*" ,"in~ex :=" &i).GetRoproperty("url")

Browser("title:=. *").page("title:=. *").Link(" name:=.*", "index:=" &i).click

Mr.Venkat (Sr. Test Manager)

Page 97 of 118

\1
~

~liveTech
s..ry

II

ttslilfl sof>tW.J

Browser("title:=. *").Sync
strActUrl=Browser("title:=. *").GetROProperty("url")
If instr(l ,strActUrl,strExpUrl,l )>OThen
Reporter.ReportEvent micPass, "Link Vaidation ","Succeed"
objSheet.Cells(i+2,l)=strLinkName
objSheet.Cells(i+2,2)=strExpUrl
objSheet.Cells(i+2,3)=strActUrl
obj Sheet. Cells(i+2,4 )="Pass"
Set C4=objSheet.Cells(i+2,4)
C4.Font.color=vbGreen
Else
Reporter.ReportEvent micFail,"Link Vaidation","Failed"
objSheet.Cells(i+2, I )=strLinkName
objSheet.Cells(i+2,2)=strExpUrl
objSheet.Cells(i+2,3)=strActUrl
objSheet.Cells(i+2,4)="Fail"
Set C4=objSheet.Cells(i+2,4)
C4.Font.color=vbRed
End If
Browser("title:=. *").Back
Next
set objWbook=obj Ex eel. ActiveWorkbook
objWbook.SaveAs "C:\OutPutdata.xls"

t----

II

objExcel.Quit
Set objExcel=nothing

r-,,

_,,-

~---

Mr.Venkat (Sr. Test Manager)

Page 98 of 118

r-'~

tl

HP Quality Center
THREE WAYS TO REPORT DEFECTS USING QUALITY CENTER:
1. Using Test Results window, Go to Tools and Click on 'Add Defect'
2. QTP submit defect for each failed step- QTP is connected to QC we have to Select option (Go to toolsL1
OptionsO RunO Select the "Submit a defect to Quality Center for each failed step")
3. Login into Quality Center and report the defect

I
Ij
I

II

INTRODUCTION:
Quality Center is a Test Management tool from HP (Mercury Interactive)
It is a web based application
FOLLOWING ACTIVITIES ARE PERFORMED IN QAULITY CENTER:
1. Is a repository(Requirements, Test Cases, Test Results and Defects)

2. Is a management tool (Traceability Matrix, Test Execution)


3. Is a defect reporting and tracking tool
4. Is reporting tool (Reports and Graphs for Test Results and Defects)
OTHER DEFECT TRACKING TOOLS:
Bugzilla, Dtracker, Issue tracker, Clear quest and Cdets
VERSIONS OF QUALITY CENTER:
8.2, 9.0, 9.2 & 10.0
TEST DIRECTOR:
is the earlier version of Quality Center
versions of Test Director:
5.0, 6.0, 7.0, 7.6 AND 8.0

'

~:
j.

QUALITY CENTER COMES IN TWO COMPONENTS:


A) Site Administrator:
It is to configure the settings in Quaiity Center like creating Domain, Project,
Project Users and their Privileges is managed by the Quality Center administrator
Accessing Site Administration:
HTTP://SERVERNAME/SABIN
B) Quality Center:
Accessing Quality Center:
HTTP://SERVERNAME/QABIN/ST ART.HTML
Login Page consists of the following:
USER NAME:
PASSWORD:
Authenticate
DOMAIN:
PROJECT:
Login
If the User Namc.and Passwords provided are valid then the domain(s) and project(s) to which the user is associated
will be fetched.
NOTE: One user can be associated to one or more than one projects in a given
domain and also can be associated to one or more domains

,-.-

QUALITY CENTER MAINLY CONSISTS OF 4 COMPONENTS:


1. REQUIREMENTS:
Is to store the customer Requirements.
There can be two of Requirements created in Requirements tab

Mr.Venkat (Sr. Test Manager)

Page 99 of 118

~LiveTech
wlino sofh""
liufy

A) NEW REQUIREMENT:
New requirement is to create a parent or sibling to the existing requirement
Navigation:
REQUIREMENTS --> NEW REQUIREMENT

B) NEW CHILD REQUIREMENT:


Is to create a requirement within a requirement
Navigation:
REQUIREMENTS --> NEW CHILD REQUIREMENT
We can create any number of Requirements based on the project Requirements
THERE ARE 4 VIEWS IN THE REQUIREMENTS TAB:
A) REQUIREMENTS TREE:
Will display the Requirements in the tree format
Will be able to create the Requirements from Requirements tree
Navigation:
VIEW --> REQUIREMENTS TREE
B) REQUIREMENTS GRID:
Is to display the Requirements in a tabular format and we cannot create the Requirements in this view.
Navigation:
VIEW --> REQUIREMENTS GRID
C) REQUIREMENTS COVERAGE:

Can create the Requirements and also is used to map the Requirements to the Test Cases to perform Traceability
Matrix to ensure the amount of coverage in Test Execution with respect tot he Requirements
Navigation:
VIEW ->> REQUIREMENTS COVERAGE
MAPPING THE REQUIREMENTS:
Select the requirement, and select "select tests", the Test Plan tab is displayed on the right hand side of the screen,
navigate and select the Test Case(s) and click on left arrow.
NOTE: We can have one or more Test Cases or Test Scripts to a given requirement.
D) COVERAGE ANALYSIS:
Is to analyze the Requirements post execution, the status of the requirement is displayed with complete analysis with
the graphs and the numbers.
REQUIREMENTS GENERAL Y CAN HAVE DIFFERENT STATUS:
A) NOTCOVERED:
Is a default status of the requirement, when a requirement is created and no Test Case is associated.
B) PASSED:
When all the Test Cases associated with the requirement are executed and have the status as passed
C) FAILED:

When at least one Test Case is ended in a failed status for a given requirement
D) NOR RUN:

Test Cases associated when not yet executed.


E) NOT COMPLETED:
A partial:y executed Test Cases (at least one Test Case not executed)
2. TEST PLAN:
Test Plan tab is to create and >tore manual and automation Test Cases.

-~~-

CREATING A MANUAL TEST CASE:


FIRST CREATE THE FOLDER STRUCTURE.

~----

Mr.Venkat (Sr. Test Manager)

Page 100 of 118

-~

-:-

~llveTech
fiulj ttsthJn i<>lti
NAVIGATION TO CREATE A TEST CASE:
TESTS -->NEW TEST
Specify the name of the Test Case and specify the Test Case description and in the design steps create the steps for
Test Cases (Step Name, Step Description and Expected Result)
NOTE: Creating Test Cases from Quality Center is not preferred as the server (QC)
might get slowed
down and might crash, hence the Test Case design is preferred in
external sources like MS Excel and MS
Word documents.
UPLOADING TEST CASES FROM MS EXCEL:
Specify the folder path in the excel document to which the Test Case have to be
uploaded, every folder should be preceded with a backslash (\)
EX: \INSURANCE\HEALTHINSURANCE
Select the Test Cases and go to Tools and select "Export to Quality Center".
Following are the steps:
STEPl: Enter the QC URL and click next
HTTP://SERVERN AME/QCBIN
STEP2: Enter the User name and Password and click next

STEP3: Select the Domain and Project and click next


STEP4: Specify the location where the Test Cases have to be uploaded
SELECT "TESTS" AND CLICK NEXT
STEPS: Specify the map name select "Create a New Map" and specify the map name
and click next
STEP6: Map the Quality Center fields with the excel fields and click next
STEP7: Is the process of uploading the Test Case to Quality Center
STE;P8: Click Finish
QUALITY CENTER INTEGRATION WITH QUICK TEST PROFESSIONAL:
To connect to Quality Center from Quick Test Professional, in quick test:

Navigation:
FILE--> QUALITY CENTER CONNECTION
STEPI: Enter the URL and click Connect
STEP2: Enter the User Name and Password and click Authenticate
STEP3: Select the Domain and Project and click Login
After the connection is established, we can see the tests to "Test Plan" tab of quality
open the tests from Quality Center for enhancements for execution.

center or we can

3. TEST LAB:
f--

Page 101 of118

i-

Is the place where the Test Execution is performed:


MANUAL TEST EXECUTION PROCESS:
Create the folder structure and create a "Test Set"
NAVIGATION:
TESTS --> NEW TEST
NOTE: A Test Set is a collection of manual Test Cases or Automation Test
Scripts.
MAPPING THE TESTCASES TO THE TEST SET:
Select the Test Set and click on "Select Tests", the Test Plan tab would be
displayed on the right hand side of the screen, Browse the folders and select the
Cases and click on left arrow(<--) executing the manual Test Cases: This
ways:
A) RUN:
When selected, only the selected Test Case will be executed
B) RUN TEST SET:
When selected, all the Test Cases associated with the Test Set will be
executed one after the other in a sequential order.

~--

Test
can be done in 2

MANUAL TEST EXECUTION PROCESS:


Select the Test Case in the Test Set and click on "Run", manual test runner will be
displayed, click "Begin Run", complete steps of the Test Case will be displayed
with the
Step Name, Time and Date, Step Description, Expected Result and a
Textbox to capture the
actual result.
Perform the operation on the application by going through the step description and compare the actual response from
the application with the expected result, if they are matching, select "Pass Selected" by updating the actual result
and after ali steps are completed click "End Run"
If the expected is not matching with the actual result, click on "Fail Selected" and
click New Defect, a defect
template will be displayed and fill in all the necessary attributes and attach the snapshot of the defect screen and
click Submit, there would be a Defect ID generated by Quality Center and the reported defect will be uploaded in
Defects tab.
NOTE: Based on the status of the Test Cases in test lab, the status of the
Requirements will be updated in the Requirements tab of Quality Center.

AUTOMATION TEST EXECUTION PROCESS:


Create a Test Set and map the Scripts to the Test Set created and specify the "Host Name" on which the test has to
be executed
When performed run on the selected Script, Quality Center will by default launch the Quick Test Professional and
will load the Script qnd will update the status of the test in Quality Center.

NOTE: To ailow Quality Center to launch quick the following configuration has to be done in QTP:
Navigation:
TOOLS--> OPTIONS--> RUN--> ALLOW OTHER HP PRODUCTS TO RUN TESTS AND COMPONENTS.
4. DEFECTS:
Is to store and track the Defects that are reported in the Test Execution process done in
Defects reported from test lab are also stored in the Defects tab.

test lab. The

We can also report Defects from the Defects tab, but this is done there is no related test case for the
defect identified.
GENERATING REPORTS AND GRAPHS:
We can generate reports and graphs in Quality Center for the Requirements, Test Results and the Defects.
Navigation:
ANALYSIS -->REPORTS and
ANALYSIS--> GRAPHS

~---

Mr. Venkat (Sr. Test Manager)

Page 102 of 118

~!CWW'T'P'"II!A

IWniBIIIIII~"'QP

N'tMI

m:ultll

WM

~IOO.Ia!~'<f!:G!.'-"'iO!il:a~lfJ;i.Ur.ii!.IJIWW'~~IIIIIIIIIICIIill!!isr"PPJ.W?!HM'i

~-~~~
[-HP
--------~~~

__ _____

3:
'""!

,.__

<

(1J

sa~

!:?..

_.-...

C/)

flc&u nJ ob

""'

CQ c use.(

(1J

-3:

c Y.a}e DCir0oJ '()

(/)

P:>

::l

ere~

~')E' a. c_h <~E

&Q.B

A-nn

,2.

j: 1<-.S

Te..s+ P k&t

'Dc.>-p p ,

'?J

F.,-- o.rne

Wcvt:..

c~CY)

g.

~CMh

.T.st- Lob

nokt.b~e

-Poe.Pd

r>evec~s

Pl

::;;~,~~:.='"'-"-";:;--...;_:__..: __ ,. __ ::.::..:.-;.;.,':_.;.;-;_;,.:_:..;;.:.:.:-=.:;;;...o..:_, . ...;.;_ __ .-

--r-r,. rlr 11

'-

e-1-c

'Y

r'C.s

US';:J

T-e.s+

r~s1

CO-d'~

t-es+-~

Ub~

wr'\-0

1'.8-t-

Lob

~
-?c~

~u~

x..e..u....*=

yes!- CO.d~

Qapat

Hl

~+

i 6.

'

.f rG4v-e_

,()e,bec_Jj

'?J

lt.s I '-'::)

T e .s+ ~

\JJ- ~

c..ts;~ res+~

F x.-e Whi7V)

G-Jo{/'--

j.

G~r-oJ,~

iapCT(h

s; l.YI'(Jd.S

~Ufh ~

Pe,b-ecb

i0

u.s

CA....S

(.{j,':J

I~ TEJ+

oe-&cC)
Tc:..--b
f.s,b

~~.

\- oe,fe.cl--

'-

0
"""l

',

t2p~W--,;'-j,_,.-/
I D~cl-- ~';J~'

I.;.)

00

'
Ex: -e c.uJ-ion

.__;' /1'

&elf,yP

~u~rern~

3o To+ Cc..J~ US~?j

<i. Deje-c..+

'

Oe,fec)-

<

--

"Tt:.s-1-

o~c.K. vp

sk CO->~~r-~~

'"d

V~-S

s Ul.A.lct

T-est

rnu...p P :':3

- ._ .t
"1'

fdck o..u.d.

IO

r=

u...J.~~

~0; le-#'1Jl.k

w; H,

1Y1a...i~1..~ce_

Limr..t<.S~

~~

4 l"-'FV+ 3:::::>

frob T s+- & c~cu-. o_s 5,


ADo Tes-t- c~ J
-

se ss :m rvxJ rcJ--e. y-p..t_(. ce


,Se..rve ,.

f:t
~---

s e.& I f'R._-5,

A--0 o

3 A-00

CLS <> .o;

M,'flllll9fW!ISftijjlii-

C'D

. l

U<.Sevs

Pr cH v c.Jf' /

:-==::\

l~t~c.~

,T~

L A-DO

F)-S~ijD {JYojecJ:s

lllillillllliiiiEtt"'!

gppr

*....c
,-

~A-DD

rr~ecJ:s

CrEcJ--C

P:>
(JQ

~~~---

-----------------

~_

\- 1/Ze 'I)JiJ<M~ ]

.......J

cepIWIC!i!!!I!W4!

\_..
~'

--

--------------

---~---- -~~----------~--

:_n:=:.~7-:~==:::.. .._.:._.:.. __;__

... . - ... . ::... .:..;.. _: _:.:...;.....

" "'c"'T"~=~~-~~l~ti-~--r-----

rI 1

_, ___. :. .;. .. ~---------"---

-~-

nr-~m

QTP Interview Questions


JI

1. Why was Automati~n used in the Project?

To

R-e_ .9 re~ sJ:\1) Te~ h'<!j

I<C2ciu ce_

I--

Ep fovt.

! ;

2. Which Framework are you using for current project?

tfy brd._

1'-~u.xrd Dr-:veJ

fro.Me ( Dola. Oriven -t-

1:

3. Where you use "Recovery Scenario"?

ffppL U.~

Crc~:>f1

~ up t-l~tJl.,'r;f{

ru.td

4. What is "Active Screen"?

1
5. Where can view the results of the Checkpoint?
T~+-

r<,-est.tl t

J,v:nJ;w

6. What is the major difficulty you faced while working with QTP?

! c.vL/Ie 8.-e~h~

1-yc.LM Wotk_.,

No

rrw Q.JJ..d

~; Oe.h4.J fr.flJ-

;}__

CQrP

Sol .

,3

fc.Ld-ed +o (l.,_Q_co3 w~e_

:.S

v, ( i---4&J

ubjE?J

So&e

CtJ...td Cn}q_c}

rYJ(.>AGv-er

'1

No

Resctlt

=-(Jy;LkJ.'c.n ahiec.t;.

HP Suppa/:

L re,.st- La_o__~

SH Lt. cJ1 rc/Lv d. c-h<./'1

sc t_

I SS u E;j .
pyc_:pevJ::t

L~+

7. Write Script to retrieve data from the Database?

s:t ob;'f<s = Ck q0Jed

ohJ~op4 /

t.l

t'

A DOQ!). &cord_Set ':)

.Se..tec ~

Q_cmtJ
~

~hox obJ'R.,s ( u ~._sfelrte1

u.JSktner

11

&bJ.CC1

./

l\)c_.-ne. ':)

8. Write script for Invoke web Browser?

9. Types of Actions?
j

T!jPEJ

rvOJ 'f{e<J.)~/e_

.t. R. e..w~ /e_


3. 'Exfe~

10. How you declare "Constant Value"?


lt_SI~

l\lr Venkat (Sr. Test Manager)

Page 104 of 118

f------c
f-~

l==
e_:

~livetech

fiufyltJtilrSsof>tW<o

11. What is "GetRO and GetTO" property'?

CfeTTo rr,jle~

(\t'J f{o

-m

f'r'F>XJ:t :
o1.l

sct

ra

Obie'*

Prpeli~ c~

f'Ydpe-rh,.s <Yfl f'.,<2.p<Js:te><J

Lm"""JoJc

Dv~, ~~
P=i'-(bh'e,j
J..
. .1!.1

obiecl ( yfJ"'-'d,.:tu;J :t-llLL+

'

12. Can you explain the AutomatiOn Process you are following m your comp':iny. -::::1
~{(' e

s \-e.-a~

1" o o I [ \J c-luo-FO() .

El--b-ur+ t-S<h r0c.-h'cn


F'(~ lt.bit-- crfo.-.h 'c.fYJ .
13. What is the difference between "Call to Existing Action" and "Call to copy of Action"1

c~ +a
a:U{

t)t's h_j

-/-tl C..opj

ftc!,'c> :

oP

}Q.eo. J (}()~

A-d&> :

R&d. cutJ (J'<l',Je_.

14. Difference between WebTable and Webltem


~To-b/e.

15. How to close Pop Ups during Runtime

u.s~

shill obJ~ech

s<U:

obJoheJJ. =
"h,"c.s 1--)e.tt. f)(")

. ow o elet e cooki es
t d
16 H
us' :3

'-<!

1AJ.~u<h'l ob..Jed:

c~ c!~.Jec/;( ~~

,~pup

V05Cnpt' &he.Lt ~

'' rn-es.SOfJ.e_

'f

'

-[im-e. <...t

.5a'Y)JJ

~ebvJ-J I ()QLUe_ Coot<:.J'q


17. How to get number characters from given string
Lt.5 ;~?

()')I

rru'J..

~ <.JII)c_}, ~

C~~ csl-o ,f( ~J- ,j

18. How ta handle runtime errors

,-,-

19. What is relative path'?

,_
~

ji--------

:}

;;

_-,-

20. How to check tool tips using QTP'?

Page 105 of 118


Mr.V enk.at (Sr. Test Manager)

i ----- --

I==

21. Difference between Action and Function


Action
1. QTP Concept
2. Actions require Object Repository
3. Actions require Build
Function
1. VB Script Concept
2. Without Object Repository functions can be developed
3. Without Build we can develop functions

l---

.l

22. Runtime Error HandJing (To handle Runtime errors)


On error resume next

23. All Extensions supported and used in QTP


.mts
- Mercury Test Script
.tsr
-Test Shared Repository
.xml
- Extensible Markup Language
-.qrs
- Quciktest Recovery Scenario
.xls
- Excel Spread Sheet
.vbs
- Visual Basic Script
.mtb
- Modular Test Batch
.mst
~ Modular Script Template
.UDL
-Universal Data Link
- Activex data object database
ADO DB
OLEDB
-Object linking embedded database

u.sed

,1ji.

Set obJ' ccn

get

o~ COil)

81 o.bj f\J

se+ dbi F~o


S'-d

seA:

s.&-

d\:ll fx CU
~-

'n

J')
LI \' 4tJaD"
o . CC~V\-.e cJC.n Y

:::

c__)'fu~db.iC: cr

c ~db;"ecl: (_ 1r ft-OoDC!>

--

- A.

cd-ecb.J-ed: [

l\

-:::

COft\Y>1d4d

ttDdiJ8

<.:x~k~e cl- (
C'rGzk~ec.t-

r fx

[lt

(_yt:o-k_ ~ 'e_c):; (

Mr.Venkat (Sr. Test Manager)

L1

':J
9

l<.e(uvd.Sel-1

cY"&k o.~ecl- ( ' SGy}'ph';j


1

az rp

o~'slvt

(QTp

F/t-e<{yJcfc:Mo'b,feo{:J

eli A-(JpU~~ ')

Ltt.tt'cl{,~f:. Ftpp U Gh;;11 ' )


h.}SGnpi: S 4eu_

11)

Page 106 of 118

'
r--

tl

QTP 11.0 New Features

II

1. Good Looking and Enhanced Results Viewer


2. Load Function Libraries at Run Time
3. Test Your GUI and UI-Less Application Functionality in One Test
4. Record Support
5. Much Awaited Log Tracking is available now
6. Embed/Run JavaScript in web pages
7. Web 2.0 Toolkit Applications Support
8. Automatically Parameterize Steps
9. Silver light Add-in
10. Extend WPF and Silver light Support
11. Use Extensibility Accelerator for Web Add-in Extensibility Development
12. Avoid Downtime Due to License Server Failures

1. Good Looking and Enhanced Results Viewer


The new improved results viewer provides an executive summary page with summary data, pie
charts and statistics for both the current and previous runs and a quick link to the previous run
results.

~St-~1: ........
~.,o. 4::J.,.~:on

S."2'!V2010. :::OV:U
):01- (:11(0

2. Load Function Libraries at Run Time


With the help of LoadFunctionLibrary statement. You can now load a function library when a
step runs instead of at the beginning of a run session.

-'.-

3. Test Your GUI and UI-Less Application Functionality in One Test

~--

,-,~

Since QTP is integrated with Service Test, you can now test your GUI and non-GUI based apps
in a single run.
--

~--~

Mr.Venkat (Sr. Test Manager)

Page 107 of118

4. Record Support
For FireFox is now available.

5. Much Awaited Log Tracking is available now


QTP 11 is capable of receiving Java or .NET log framework messages from your application
which can then be embedded in the run results.

6. Embed/Run Javascript in web pages


You can use the new EmbedScript/EmbedScriptFromFile and
RunScript/RunScriptFromFile functions to embed JavaScripts in all loaded browser pages.
You can use these scripts to perform operations on, or retrieve data from, the browser pages in
your application.
7. Web 2.0 Toolkit Applications Support
QTP 11 now supports Web 2.0 Toolkit Applications out-of-the-box similar to any other add-ins.

8. Automatically Parameterize Steps


You can instruct QTP 11 to automatically parameterize test steps at the end of record session.

9. Silverlight Add-in
To test objects in Silverlight 2 and Silverlight 3 applications. [After installation, Silverlight Addin is displayed in the Add-in Manager as a child add-in under the WPF Add-in]

10. Extend WPF and Silverlight Support


You can use WPF and Silverlight Add-in Extensibility SDK to develop support for testing thirdparty and custom WPF and Silverlight controls that are not supported out-of-the-box
11. Use Extensibility Accelerator for Web Add-in Extensibility Development

12. Avoid Downtime Due to License Server Failures


Useful for concurrent license users. With redundant license servers you can create failover, so
that if your main license server fails, your remaining servers maintain availability of your
licenses without causing any downtime or loss of licenses for users.

Mr.Venkat (Sr. Test Manager)

Page 108 of 118

~-

~liveTech
linn
finfy us

sofIW.,

Flat File Scripts to Practice (FSO)


1. Create a Folder
DimobjFso
Set objFso==CreateObject("scripting.FileSystemObject")
objFso.CreateFolder "C:\LiveTech"

2. Check if the Folder Exist or not? If not create the Folder


Dim objFso, myFolder
myFolder=="C:\LiveTech"
Set objFso==CreateObject("scripting.FileSystemObject")
If Not objFso.FolderExists(myFolder) Then
objFso.CreateFolder (myFolder)
End If

3. Copy a Folder
Dim objFso, myFolder
myFolder=="C:\LiveTech\Qtp"
Set objFso==CreateObject("scripting.FileSystemObject")
objFso.CopyFolder myFolder,"E:abcd"

4. Delete a folder
Dim objFso, myFolder
myFolder=="C:\LiveTech"
Set objFso==CreateObject("scripting.FileSystemObject")
-:~-

objFso.DeleteFolder( myFolder)

2nd

IL_____
~

Dim objFso, myFolder


my F older=="C:\LiveTechQtp"
Set objFso==CreateObject("scripting.FileSystemObject")
~-

Pagel09ofll8
Mr.Venkat (Sr. Test Manager)

'
r,____
g

~liveTech
mtfy
soltimu
ltslin!l

If objFso.FolderExists(myFolder) Then
objFso.DeleteFolder( myFolder)

....

End If

t--

5. Return a Collection of Disk Drives


Dim objFso, colDrives
Set objFso=CreateObject("scripting.FileSystemObject")
Set colDrives=objFso.Drives
For Each oDrive in co!Drives
Msgbox oDrive
Next

6. Get available space on a Drive


Dim objFso.
Set objFso=CreateObject("scripting.FileSystemObject")
Set myDrive=objFso.GetDrive("D:")
Msgbox myDrive.AvailableSpace/(1 024"3) & "GB"

7. Creating a Text File


DimobjFso
Set objFso=CreateObject("scripting.FileSystemObject")
objFso.CreateTextFile ("C:\LiveTechQtp !.txt")

j
l

objFso.CreateTextFile ("C:\LiveTechQtp2.doc")
objFso.CreateTextFile ("C:\LiveTechQtp3.xls")

.-:-

objFso.CreateTextFile ("C:\LiveTechQtp4.pdf')
Note: We can Create other files also, but they act as Text/Flat Files

8. Check if the File Exist or not? If not create the File


Dim objFso, myFilel ,myFile2, myFile3, myFile4

-~

Mr.Venkat (Sr. Test Manager)

Page 11 0 of 118

-~-

~liveTech
IW<fl tUn"'"'"""'
Its

myFile 1="C:\LiveTechQtp l.txt"


myFile2="C:\LiveTechQtp2.doc"

i----

myFile3="C:\LiveTechQtp3 .xis"
myFile4="C:\LiveTechQtp4.pdf'
Set objFso=CreateObject("scripting.FileSystemObject")
IfNot objFso.FileExists(myFilel) Then
objFso.CreateTextFile (myFile1)
End If
If Not objFso.FileExists(myFile2) Then
objFso.CreateTextFile (myFile2)
Endlf
If Not objFso.FileExists(myFile3) Then
objFso.CreateTextFile (myFile3)
End If
If Not objFso.FileExists(myFile4) Then
objFso.CreateTextFile (myFile4)
End If

9. Read Data Character by Character from a text file


Dim objfso, myFile, myChar
Set objFso=CreateObject("scripting.FileSystemObject")
Set myFile=objFso.OpenTextFile("C:\LiveTechQtp.txt",l) '1 for Read, 2 for Write and 8 for Appc11d
Do Until myFile.AtEndOfStream=True
myChar=myFile.Read(l)
Msgbox myChar
Loop
myFile.Close

Page 111 of l 18
Mr.Venkat (Sr. Test Manager)

l - ------

g.._____

~liveTech
ktfylulioflwlltti.Jo,
e;

Set objFso=Nothing

Jj

10. Read Line by Line from a Text File

Dim objFso, myFile, myChar

Set objFso=CreateObject("scripting.FileSystemObject")

Set myFile=objFso.OpenTextFile("C:\LiveTechQtp2.txt", I) 'I for Read, 2 for Write and 8 for Append

!t
j

Do Until myFile.AtEndOfStream=True

I
I
I

myChar=myFile.ReadLine
Msgbox myChar
Loop

I
I

myFile.Close
Set objFso=Nothing

11. Data Driven Testing by fetching Test data directly from a Text file.

'************************************************************************************

*
'Test Requirement: Data Driven Testing by fetching Test data directly from a Text file.
'Author: xyz
'Date of Creation: 24-08-2010
'Pre-requasites:
'abcd.txt (Test Data File)
'Test Flow:
'Create File System object

'Open the file with Read mode and store reference into a variable

'Skipe the first line

;:;-

'Read line by line and split the Data

..

'Login Operation
'Form Looping and pass Parameters

Mr.Venkat (Sr. Test Manager)

'

Page 112 of 118

F
I

'************************************************************************************
*

~-

Dim objFso, myFile, myLine, myField


Set objF so=CreateObj ect("scri pti ng.F ileSystemObj ect")
Set myFile=objFso.OpenTextFile("C:\LiveTechQtp.txt", 1) '1 for Read, 2 for Write and 8 for Append

myFile.SkipLine

!
l

Do Until myFile.AtEndOfStream =True

Ii

myLine=myFile.ReadLine

I
1

myFieid=Split(myLine," ,")

~~

SystemUtil.Run "C:Program FilesHPQuickTest Professional\samp1es\flight\app\flight4a.exe"

,~~

Dialog("text:=Login").Activate
Dialog("text:=Login").WinEdit("attached text:= Agent Name:").Set myField(O)
Dialog("text:=Login").WinEdit("attached text:=Password:").Set my Field( 1)
Wait 2
Dia1og("text:=Login").WinButton("text:=OK").Click

I~
I
I

I
l
u

Window("text:=Flight Reservation").Close
Loop
myFile.Close
Set objFso=Nothing

12. Write Data to a Text File

Dim objFso, myFile, Result, a, b

a=lO: b=20

iI
I
I

,-,-

Result=a+b
Set objFso=CreateObject("scripting.FileSystemObject")
Set myFile=objFso.OpenTextFile("C:\LiveTechQtp3.txt",2) '1 for Read, 2 for Write and 8 for Append
myFile.WriteLine "Addition of a, b is: "&Result

Page 113 of 118

Mr.Venkat (Sr. Test Manager)

'

myFile.Close
Set objFso=Nothing

13. Delete a Text File


DimobjFso
Set objFso=CreateObject("scripting.FileSystemObject")
objFso.DeleteFile("C:\LiveTechQtp.doc")
Set objFso=Nothing

L _____ _

Mr.Venkat (Sr. Test Manager)

Page 114 of 118

-~t_ ______ _

r--

~liveTech
tiNfyltslilflsdllima
14. Check if the File Exists or not? If Exists delete the File
Dim objFso
Set objFso=CreateObject("scripting.FileSystemObject")

t-

If objFso.FileExists("C:\LiveTechQtp l.pdf') Then


objFso.DeleteFile("C:\LiveTechQtp.pdf')
End If
Set objFso=Nothing
15. Calculate size of a Text File
DimobjFso
Set objFso=CreateObject("scripting.FileSystemObject")
File_Size= objFso.GetFile("C:\LiveTechQtp.txt").S ize
Msgbox File_Size&" Bytes"
Set objFso=Nothing

16. Capture Customer Names from 1 to 10 Orders in FR and export to a Text File

*****************************************************************

I
'

'Test Requirement: Capture Customer names from 1 to 10 orders

II
I
g

'and export to text file


'Test Flow:
'Create im object in File system class

'Open the text file in write mode using File system object

'Login Operation

I
I

'Form Loop to open 1 to 10 orders


'capture the Customer names and write to external text file
r:-r;

'*****************************************************************

t--

Dim objFso, myFile

Mr.Venkat (Sr. Test Manager)

Page 115 of 118

c=

~liveTech
wt.n;,s
ftulj ttslilln

Set objFso=CreateObject("scripting.FilesystemObject")
Set myFile=objFso.OpenTextFile("C:\LiveTechQtp.txt",2)
myFile.WriteLine "Customer Names"

l---

myFile.WriteLine "---"
IfNot Window("Flight Reservation").Exist(3) Then
SystemUtil.Run "C:Program Files\HP\QuickTest
Professional\samples\flight\app\flight4a.exe","","C:Program Files\HP\QuickTest
Professional\samples \flight\app", "open"
Dialog("Login").Activate
Dialog("Login"). WinEdit("Agent Name: ").Set "LiveTech"
Dialog("Login").WinEdit("Password:").SetSecure "4c9e05a626f9b6471971 fb 15474e791 b28cc ledO"
Dialog("Login").WinButton("OK").Click
Endlf
For Order_Number= 1 to 10 step 1
Window(" f) ight Reservation ").Activate
Window("Flight Reservation").WinButton("Button'").Click
Window("Flight Reservation").Dialog("Open Order'"). WinCheckBox("Order No.").Set "ON"
Window("Flight Reservation").Dialog("Open Order''). WinEdit("Edit'').Set Order_Number

"- ' :~

Window("Flight Reservation").Dialog("Open Order").WinButton("OK'').Click

c,

wait 2
Customer_Name = Window(''Flight Reservation"). WinEdit(''Name:'').GetVisibleText()
myFile. WriteLine Customer_Name
Next

~.-

myF ile. Close


~-----

Set objFso=Nothing

'
--

17. how to verify update Order behaviour in the Flight reservation application and how'to pass
multiple values from the textfile

~-----

Mr.Venkat (Sr. Test Manager)

Page 116 of 118

Option explicit
Dim fso,f,s,arr,strStatus
Set fso=CreateObj ect(" Scripting. filesystemobj ect")
set f=fso.OpenTextFile("E:\Records.txt", l)
While not f.AtEndOfStream
s=f.ReadLine
an=split(s," ")
Window("Flight Reservation'').WinMenu("Menu").Select "File;Open Order ... "
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set "ON"
Window("Flight Reservation ").Dialog("Open Order"). WinEdit("Edit").Set arr( 1)
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click
strStatus = Window("Flight Reservation").WinButton("Update Order").GetROProperty("Enabled")
If strStatus="False" Then
Reporter.ReportEvent micPass,"Update is Disabled","Test is pass"
Else
Reporter.ReportEvent micFail, "Update is Enabled", "Test id failed"
End If
Wend
f. Close
Set fso=nothing

18. Descriptive Programming

*****************************************************************************
Set objFlyFrom =Description. Create
objFlyFrom("Class Name"). value= "wincomboBox"
objFlyFrom("attached text").value ="Fly From:"
Set objFlyTo =Description. Create

Mr.Venkat (Sr. Test Manager)

Page 117 of 118

~liveTech
firtfy wlino '"'""""'

objFlyTo("Class Name"). value= "wincomboBox"


objFlyTo("attached text"). value= "Fly To:"

l----

'Set objwin=Description.Create

..

v-.._

'objwin("text"). value=" Flight Reservation"


FlyFrom_IternsCount = Window("text:=Flight
Reservation"). WinComboB ox(objFl yFrom). GetitemsCount
For i=O to FlyFrom_ItemsCount-1 step I
FlyFrom_Item = Window("text:=Flight Reservation"). WinComboBox( objFlyFrom).Getltem(i)
Window("text:=;FJight Reservation"). WinCcmboBox( objFlyFrom).Select FlyFrom_Item
FlyTo _ ItemsCount=Window("text :=Flight Reservation"). WinComboBox(objFlyTo). GetitenisCount
For j = 0 to FlyTo_ItemsCount-1
If strcomp(FlyFrom_Jtem,Window("text:=Flight Reservation").WinComboBox(objFlyTo).Getitem(j))=O
Then
Reporter.ReportEvent micFail, "step!", "Item equals in Fly To"

else

Reporter.ReportEvent micPass, "step I", "Item equals in Fly To~'


End If

fi---

I
rl

Next

-rJ-

Next

'*****************************************************************************

I
I

.----

I
Mr.Venkat (Sr. Test Manager)

Page 118 of 118

r--

~
L__

Tts.-1:: scri p-I:

J
1 ...,

[;

-l)
1

A S .s u

c, c..it

~ OuY~

.3 .

f\ c__l-if)

1'\._(_{N

r() (JE'rt

f,'"'\2
h' -Q,J

b.

~~;c'

"e

~
~

F.

~-,-

~------

._

L_

;;__:___:_:_::_
~

. !

Dchla. -hlbe ArJot.S~e.ct. u Inpctt~lf

~-lab Ie I"-jlalsh~

tt \

\sf'.(Ler\ L,v' H

~ <.<: >< Ls ~1

l< P ,-\ l

C i-f LAJJ \

J, ''-'- "f ~t

=~re, c; e~-&luzct ( ''J"''rthobh / ). Get~fu.~

fZo<.J ecu.l:

+-o

For ,:.::. f

. ' CCLVLt:_
._ J
L-..,
s''-t'

l-

y- c_....._,

DJz k,hl e_ Set CJ.jtrtvJ:-~ (_ lj .


S';tjo b""~ ~.th 'L . lLurl

di~.L2:f ( u Loa~ "1

u f2rle pc:Je.

~~)- w ~--~~-e~ (

t,

~~).

A-EJeL...-i NcJI1e :

t t

L~ C' ~I.!J W<"l.,eJ,'-t ("NSvc;l: t').

cLl~l,_ li.J ., ~ ,l._b~q

d.i~

/2Qpvrk:; l&.rx1rf:e.~...reJ

d.cJc:ef<>b [-c'
,

1
,: ' ~
l>cl9

\..o-..._)

(_ U () k._

N-l..Cp,---e,-~

V.:-Lc"{_ (

t l.fe.*.

Sek

sd

IJ . c1_tde._
l.~' ~":j

rf'-N_/ b

'_;

v"-.L..e_

c~~ ir

l\

fc~(J

ocJuJccJJ--e . \[ 0-...~

'

(t~p~~~ r 11 -~J-4JJa!_}

La:r'c,. /~
II

Dw-lz.Jc-bfE

1"-

J-eua.

f=-i-;s

-5

i ~~ c::(~ 1j ~

!l

-kf(#-

~~~

11

{Jc>-5.J /i

I .\ r 1
1 tJ ,, ~
1
lr)
L
r Ltc.)'t_rt ~c)Hie-n-;:t, j Oe~

{J__Qfcdct; R.c.-rcxt E:-~~_,cl-

b ,Jq_ h~]K? . \(c::_.kt't'

'

(I

cFc<-l.(/

(_ \\ ,f-c-;4- ~ l) t~) r (
.I

e-,'

t.rf:Jv?,J
\t f 'L.p

Lc'J-{4..;

![

LJ+~ ('.) :::-

J-cA- ;.5
i

~~(It

s -,:e.; (

fJQ>cT
1

t >cf c.-'f t

{)o-tcz

f-est (~.

pc:.~+d'biE, -[,x.pc:rt-.SLu.l \.\ \ ~-t_f~

'

reo~L~\~16 xJ.8 ~ tlrufdo/-q

:_ _____ _

'--L -

r~

1-

>'.

l~

Li

I;

t'i-

!1

,,

--

q
f~.;--

i'-

--

~-c,.-_--

'

(f)

(JJ

c~{'_

l~J Co
~

mo~rejr~J-s~QS

fD 14

ob S--M..re__

TeJ.t-

TCCJ .-1-

~n Fut~
LCj

OU--tl

(Ftr- ~tt l 0 ~

()o.Lbfl'.

c)_{clc._

UVJ

\I

~,

Vi.u'r

fir-e_

L1
~

11

~
~

~
~

Li

-:f

r~

b-------

"~

~-

[T---

Tuk-tvrew q;ue.sf-r(ns

ma.nuo.l--re.s.~~

OY)

,___,

CLtSbev-

v ~-w

flrt:Jf:'~e.

fd."-t f-rotJ.'te
-

ch~e

pc~-~ J

~ f~

-'-;:> lo.pJ<,p

spe.c.fi~

--") c,-J.e..

pnce_
cyuc.~

r~~ rY1ade__
.~Lirr~

t=J

DefO\+~ ~~.

f4> ~e
~

~'-,shc:-hUJ.
O::.iH .(j\.b -Q. -

liclb.._

A-.i...v~

'""-.

__n_~~
!'\....<.._~
I

s-~o

~~tiD
------

~Pi

~-

~
~
....
~

ff

h,.oJ &

braD6er

( " Pf'lc_ hli :


(_"

pm(

i~

c..

b "cwser C" P""c ::nx

bm..wer "pm ( CJf) (

J . tvebeJ,f (" li5E'~dJ set '~r"

J pc'!Je_(," p rnc

nc.

j . Puge L" Pm c

"c . j

1
'.)

P* (' pr>n c_

1N

.~t (''

~ u.h h4~

PaM .brd J sd; "

("

Re.~ <"

Swb";ej did:_

j . pc~ L"~,'). r ra..., (_ cr~ j ' L'u..K


/1

t{

E-- L 'f- pro~~~ IJ c&"u._

.b /'C:tcJS<?r L"
r p<Y)(_ Ih. (. . J
o)
))
1'/;-.p <(} e.l!'<f\lwPc"':3e_t.,l
~ J F '~"-(_'. c {.)0h/J. '6
. h6 ""'
I

1
(_ '

pht:Jpe /:_) St?Ieu-

b.,ause,r (" p JY1 c :r~ C . .") pOj'e. (I' ~j F rc.vo,e( " CDedails ;r)

upcbJ-ecdo=:~
---------

f'l 9~t Nc..ft'le /


\)~

pc_.s.s 0-Lyd
1\..o.D-vc_:J

~~~e "

TY7v~:J:
-~~ee_Jd_
pc~~,J_

fcuno.r 9)
~~q\

ih~l
--~--~-----.

-6-1
I/ .

fh'*Ce
-t;:Lf- ~~ k
.y,'ew

h~ e:_ "(Jc~( ~iL

UYuW_ cvc::b--

\jie.....l ~

CV'-'~~

Qe~-' 'fv-Dt8~/
v~Lw

~~
~('J~

v~d..Jc ~:Jk

8
ll <6-

t\J}

(-lhJo)
~td
po1-)
(bLf

~~~,
.~.-j~'

~~~-I.

~cLeJ-

(i<h&/

~~v-L_D

9fL~

t=-.c<.+--f\1

s-

f?BT

't

tr:

u[__

I'VI.scSL<je

IOI~:i @

Fr~

)~~t~

.-GJ
p"~c5v=f'F- \

S, r.f"
'

efl1c I:J

tl\..

p.e#PJ/ f :>

{Jtp~ho ~
.

OJ

L'~v-i

rf,

You might also like