Professional Documents
Culture Documents
ok
ie
w
ev
Pr
ew
http://KnowledgeInbox.com/store/
Pr
ev
i
QTP Descriptive
Programming Unplugged
Bo
ok
http://KnowledgeInbox.com/store/
http://KnowledgeInbox.com/store/
ew
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form
or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except
as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the
prior written permission of the Publisher, or authorization through payment of the appropriate percopy fee to the KnowledgeInbox. Contact online at KnowledgeInbox.com/contact-us/
ev
i
6RXUFHFRGHVGLVFXVVHGLQWKLVERRNFDQEHFRSLHGPRGLHGRUGLVWULEXWHGZLWKRXWSHUPLVVLRQIURP
author/publisher by including the below reference comment header.
'Source code taken from "QTP Descriptive Programming Unplugged"
Pr
Bo
ok
This document also contains registered trademarks, trademarks and service marks that are owned by
their respective companies or organizations. Publisher and the author disclaim any responsibility for
specifying which marks are owned by which companies or organizations.
LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND THE AUTHOR MAKE NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS
OF THIS WORK AND SPECIFICALLY DISCLAIM ALL WARRANTIES, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE. NO WARRANTY MAY BE CREATED OR EXTENDED
BY SALES OR PROMOTIONAL MATERIALS. THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT
BE SUITABLE FOR EVERY SITUATION. THIS WORK IS SOLD WITH THE UNDERSTANDING THAT THE PUBLISHER IS NOT ENGAGED IN RENDERING LEGAL, ACCOUNTING, OR OTHER PROFESSIONAL SERVICES.
IF PROFESSIONAL ASSISTANCE IS REQUIRED, THE SERVICES OF A COMPETENT PROFESSIONAL PERSON
SHOULD BE SOUGHT. NEITHER THE PUBLISHER NOR THE AUTHOR SHALL BE LIABLE FOR DAMAGES
ARISING HEREFROM. THE FACT THAT AN ORGANIZATION OR WEBSITE IS REFERRED TO IN THIS WORK
AS A CITATION AND/OR A POTENTIAL SOURCE OF FURTHER INFORMATION DOES NOT MEAN THAT THE
AUTHOR OR THE PUBLISHER ENDORSES THE INFORMATION THE ORGANIZATION OR WEBSITE MAY PROVIDE OR RECOMMENDATIONS IT MAY MAKE. FURTHER, READERS SHOULD BE AWARE THAT INTERNET
WEBSITES LISTED IN THIS WORK MAY HAVE CHANGED OR DISAPPEARED BETWEEN WHEN THIS WORK
WAS WRITTEN AND WHEN IT IS READ.
ii
ii
http://KnowledgeInbox.com/store/
http://KnowledgeInbox.com/store/
Pr
ev
i
ew
Bo
ok
In Dec 2011, HP invited Tarun to its R&D center in Israel for a 4 day conference. The
conference was aimed on taking his feedback on various aspects of QTP & BPT. This
ZDVWKHUVWWLPHHYHU+3KDGLQYLWHGDQ\XVHUIURPRXWVLGHRI,VUDHOIRUIHHGEDFN7KH
invitation highlights HPs interest in getting the user community involved in enhancing
their tools.
Tarun can be contacted at www.linkedin.com/in/tarunlalwani or
www.knowledgeinbox.com/contact-us.
http://KnowledgeInbox.com/store/
iii
iii
http://KnowledgeInbox.com/store/
ew
Bo
ok
Pr
ev
i
iv
iv
http://KnowledgeInbox.com/store/
http://KnowledgeInbox.com/store/
Pr
ev
i
ew
Dedication
Bo
ok
Our vision for this book is to share our knowledge and experience with the QTP community.
It is a privilege for us to write this book and we hope that it will reach QTP Engineers across
the globe. But not everyone in this world has the same advantages, let alone the blessing
of education. Millions of children around the world today live life without hope of meeting
their most basic needs, without any education, and without the promise of a brighter future.
Education empowers. Education inspires. Education can help to lead the way out of poverty,
and provide the tools to guide the less fortunate towards a better life.
By purchasing this book, you will help a child break free from the cycle of poverty and gift
them a future full of hope. For each copy sold, we will donate 10 to organizations working
towards the worthy cause of child education. Help us to learn and foster learning.
http://KnowledgeInbox.com/store/
http://KnowledgeInbox.com/store/
Acknowledgements
From Tarun Lalwani
I actually started writing this book before my second book And I thought I knew QTP,
EXWWKHLGHDRIZULWLQJDWHFKQLFDOQRYHORYHUWRRNDQG,QLVKHGZKDWZDVLQLWLDOO\VXSSRVHG
to be my third book. Finally getting back to this book with another year of experience,
however, meant even more polished content. This book has involved a lot of research
and experimentation with different approaches and has therefore proved even more time
consuming. This, however, means more polished content and greater attention to detail.
ev
i
ew
I would like to thank Anshoo for accepting my request to co-author this book. He is one of
WKHJUHDWQGVIRUWKH473ZRUOGDQGLQSDUWLFXODUIRUPHDVZHERWKVHHNWKHVDPHJRDO
i.e. to share our knowledge with the Automation community.
ok
Pr
I would also like to thanks my family members who have always been there to support me
during the writing process and even after publication.
Bo
I would like to thank all my clients and colleagues for trusting in me and for giving me the
opportunity to work with them.
A huge credit goes to Tarun, who has always strived for a better QTP community by
constantly helping thousands of people over this course. Writing this book with him has
been an incredible experience and a lot of fun.
I am grateful to everyone who visited and provided their feedback at Relevant Codes; it
was their comments and encouragement which drove me to create the content that exists
today.
$QGQDOO\WRP\IDPLO\WKLVLVIRU\RX7RGD\,ZRXOGQWEHGRLQJDQ\WKLQJZLWKRXW\RXU
support; nothing would have been possible.
http://KnowledgeInbox.com/store/
vii
http://KnowledgeInbox.com/store/
ew
playing chess.
Bo
ok
Pr
ev
i
viii
http://KnowledgeInbox.com/store/
http://KnowledgeInbox.com/store/
Foreword
by Meir Bar-Tal
ew
When Tarun Lalwani and Anshoo Arora asked me to assist in the review of this book,
,IHOWERWKKRQRUHGDQGREOLJHG7DUXQDQG$QVKRRDUHWUXHSLRQHHUVLQWKHHOGRI7HVW
Automation; whose contribution to the worldwide community is immeasurable. So, though
the time schedule was tight, I undertook the challenge to make my humble contribution to
this impressive project.
Pr
ev
i
All through my reading I felt that QTP Descriptive Programming Unplugged is one of these
books which make you think: I wish I had this reference available in my last project.
With this third book in Tarun Lalwanis QTP Unplugged series, now co-authored by our
GLVWLQJXLVKHGFROOHDJXH$QVKRR$URUDWKH2EMHFW,GHQWLFDWLRQSRZHURI+34XLFN7HVW
Professional is handed to the Automation Developer like a cookbook.
ok
The book, which could have been easily split into two volumes, leads the reader from the
FRUH FRQFHSWV RI 2EMHFW ,GHQWLFDWLRQ WKURXJK WKH FKDOOHQJHV IDFHG E\ WKH$XWRPDWLRQ
Engineer, to the practical solutions which are the fruit of a sound and thorough research. All
these are accompanied by well suited real-life, easy to grasp and well annotated examples.
Bo
The book is an extensive in-depth compilation with an emphasis on testing Web applications.
It covers both GUI and SOA automation, and it tackles many misconceptions and pitfalls
EHJLQQHUVIDFHLQWKHLUUVWVWHSV7KHQXPHURXVZHOOGRFXPHQWHGFRGHVDPSOHVLWSURYLGHV
ensure that understanding does not remain only at the theoretical, conceptual level.
To me, QTP Descriptive Programming Unplugged marks a very important event in the
annals of automation knowledge. I am sure that the readers of this book will acquire skills
that are rarely taught in QTP courses, and it will serve them as a reference and practical
guide.
I wish to thank Tarun and Anshoo for giving me the opportunity to have a privileged
glimpse into their colossal work and wish you the reader an enjoyable and fruitful journey.
http://KnowledgeInbox.com/store/
ix
http://KnowledgeInbox.com/store/
Bo
ok
Pr
ev
i
ew
* Meir Bar-Tal is an Automation Architect with over 12 years of technical, educational and leadership experience
in Software Design, Development and Testing. Meir has helped companies establish solid foundations for their
testing activities with a wide variety of software applications and systems and across different technologies and
SODWIRUPV0HLULVDZHOONQRZQH[SHUWLQ'DWD'ULYHQ.H\ZRUG'ULYHQDQG+\EULGPHWKRGRORJLHVDQGKDV
SXEOLVKHGDQXPEHURILQXHQWLDODUWLFOHVRQWKHDSSOLFDWLRQVRI'HVLJQ3DWWHUQVWR7HVW$XWRPDWLRQ)RUWKHODVW
YH\HDUVKHKDVEHHQSXVKLQJIRUZDUGDQDPELWLRXVSURJUDPWRZDUGVWKHGHYHORSPHQWRIDQ2EMHFW2ULHQWHG
automation framework named Sunscrit, a huge project which is still underway. Meir is the owner of www.
$GYDQFHG473FRPRIZKLFKKHZDVDFRIRXQGHULQDQGVHUYHGDVLWV(GLWRULQ&KLHI$XWKRUDQG)RUXPV
$GPLQLVWUDWRUHYHUVLQFH0HLUOLYHVLQ,VUDHODQGFRRSHUDWHVFORVHO\ZLWK+35 'DQGRWKHUFROOHDJXHVWR
LPSURYHWKHXVHUH[SHULHQFHDQGSURGXFWLYLW\ZLWK+36RIWZDUHWRROV.
http://KnowledgeInbox.com/store/
http://KnowledgeInbox.com/store/
Foreword
by Colin W. Fries
ev
i
ew
,YHEHHQLQWKHWHVWDXWRPDWLRQVSDFHVLQFHEXWZDVUVWLQWURGXFHGWR+3V4XLFN7HVW
3URIHVVLRQDOVRIWZDUHLQZKHQ,VWDUWHGDMREZLWKDQ+3FOLHQW8QWLOWKHQ,KDG
SHUIRUPHGDOLWWOHELWRIWHVWDXWRPDWLRQXVLQJDKRPHJURZQVHUYLFHWHVWLQJWRRO+RZHYHU
I was keen to develop a working QTP skillset as quickly as possible. Interestingly enough,
one of the things also driving this interest was that I was thrust into a situation where I was
the automation expert, even though everyone above and around me knew that I knew about
as much about the topic as they did. Nonetheless, I was expected to produce a working set
of automated test cases as to reduce the manual testing burden of the QA team.
ok
Pr
$WUVW,IRXQGWKDW,ZDVQWYHU\XVHIXODURXQGWKLVWRROVR,GLGZKDWHYHU\RQHHOVHLQ
my position would have done I asked for (and received) vendor training. I spent a week
LQ3DUVLSSDQ\1HZ-HUVH\ZLWKD+3%XVLQHVVSDUWQHUOHDUQLQJWKHEDVLFDQGDGYDQFHG
IHDWXUHVRIWKHWRRO$QGZKHQ,FDPHEDFNWRWKHRIFH,GHQLWHO\KDGDIHZQHZWULFNV
up my sleeve. But despite taking the basic and advanced courses, there were still a lot of
questions and problems with our test suite that needed to be ironed out.
Bo
3ULRU WR DWWHQGLQJ WUDLQLQJ ,G VSHQW D ORW RI WLPH OXUNLQJ RQ 64$)RUXPVFRP DQG
VHDUFKLQJIRUDQVZHUVWRKHOSJKWWKHGDLO\EUXVKUHVWKDWZHUHRFFXUULQJ7KLVLVZKHUH
,UVWHQFRXQWHUHGRQHRIWKHDXWKRUVRIWKLVERRN7DUXQ/DOZDQL$WWKDWSRLQWLQWLPH
Tarun was already a seasoned expert in the test automation space and was particularly
adept at straightening out noobs such as myself. Over the years, he has answered hundreds
of questions from the masses (I include myself here) and has given priceless advice and
insight on everything from resolving syntax errors to developing automation frameworks.
Because of Taruns advice, the issues affecting us were resolved and we were able to create
a working automated testing framework.
$W DERXW WKLV WLPH , DOVR EHFDPH LQYROYHG ZLWK9LYLW +3 6RIWZDUHV LQGHSHQGHQW XVHU
JURXS$VLWWXUQHGRXWP\ORFDOFKDSWHUIRFXVHGRQTXDOLW\DVVXUDQFHVRIWZDUHWKDW+3
had, at that point, recently acquired from Mercury. So I joined the chapter and eventually
became one of its leaders. It was through this avenue that I came to know the other author
http://KnowledgeInbox.com/store/
xi
http://KnowledgeInbox.com/store/
RIWKLVERRN$QVKRR$URUD%\WKLVWLPH$QVKRRZDVZRUNLQJIRUDQ+3%XVLQHVVSDUWQHU
and we began collaborating on bringing them in to present at a chapter meeting. I then
PHW$QVKRRLQSHUVRQDW+3'LVFRYHUZDVLPSUHVVHGZLWKKLVVNLOODQGDELOLW\DQG
instantly knew that the audience would be in for a treat when he gave his presentation and
that his employer was lucky to have such a swell guy like him working for them. When
he mentioned that he was collaborating with Tarun for the next installment of the QTP
Unplugged series, I could hardly contain my excitement. After all, nothing excites a techie
more than a new deep dive into his or her favorite tool, right?
ew
6RIDVWIRUZDUGDQRWKHU\HDUDQGDJDLQ,ZDVDWWHQGLQJWKH+3'LVFRYHUFRQIHUHQFHZKHQ
I received word from Anshoo that Tarun was going to be at the conference. Anshoo offered
to facilitate an introduction, and of course, I jumped at the opportunity. It was a pleasure to
PHHWKLPDQGKHVWUXFNPHDVDWUXHDXWKRULW\LQWKLVHOG
Bo
ok
Pr
ev
i
So what does this have to do with the book youre about to read and reference for the
foreseeable future? When I met with Anshoo and Tarun, I realized that both of these men
are passionate about their trade, and that their passion for test automation doesnt stop at
the end of the business day. In talking to them, it quickly became apparent that they wanted
to share what theyve learned about this tool and its inner workings with their peers. After
several years and a diversion or two, theyve accomplished their goal by publishing this
ERRN,WLVP\EHOLHIWKDWWKLVERRNVKRXOGEHIRXQGLQHYHU\DXWRPDWLRQVKRSXWLOL]LQJ+3V
)XQFWLRQDO 7HVWLQJ VRIWZDUH 7KLV ERRN DQG LWV SUHGHFHVVRUV 4XLFN7HVW 3URIHVVLRQDO
8QSOXJJHG DQG $QG ,7KRXJKW , NQHZ 473 LV D JUHDW UHVRXUFH IRU WKRVH ZKR KDYH
experience writing or maintaining test automation frameworks in that it allows them to
respond to the challenges of test automation against modern software applications. After
reading this book, I hope you will come to the same conclusion. So enjoy; Im sure that
\RXOOQGWKLVWREHYHU\XVHIXOERWKQRZDQGLQWKHIXWXUH
xii
http://KnowledgeInbox.com/store/
http://KnowledgeInbox.com/store/
Foreword
by Christopher J. Scharer
Pr
ev
i
ew
Before writing the foreword to this book, I read it in its entirety, and although its content
becomes increasingly more technical, each chapter builds on the previous one and
includes several real-life examples. This book is very well written and made me become
more interested the further I read. This book is focused toward conceptual knowledge of
QuickTest Pro (QTP) with a deep dive into Descriptive Programming (DP). It is a musthave for anyone who is testing using QTP and complements Taruns previous books,
4XLFN7HVW 3URIHVVLRQDO 8QSOXJJHG DQG $QG , WKRXJKW , NQHZ 473 :LWK VR PDQ\
companies moving to an Agile development/testing approach and application developers
working side-by-side with automation engineers, it is becoming more common and even
more important for an automation engineer to understand how to use DP.
Bo
ok
With all the recent game changers in the IT industry, such as Cloud computing, Big Data,
0RELOH7HVWLQJDQG:HE6HUYLFHV,ZRXOGGHQLWHO\UHFRPPHQGUHDGLQJWKLVERRNDQG
I really look forward to the next book that Tarun and Anshoo are working on currently,
which I believe is going to focus on testing methodologies and frameworks. I also hope to
be able to coordinate with them both to include a section on using Code Templates
http://KnowledgeInbox.com/store/
xiii
http://KnowledgeInbox.com/store/
Contents
Preface ............................................................................................ xxiii
Who this Book is For ............................................................................................... xxv
Questions or Feedback Related to the Book ............................................................ xxv
Source Code in the Book ......................................................................................... xxv
Bo
ok
Pr
ev
i
ew
2EMHFW,GHQWLFDWLRQ6HWWLQJV .................................................................................... 15
Local Object Repository (LOR) ................................................................................ 16
Shared Object Repository (SOR)............................................................................... 18
$GGLQJ2EMHFWVWRWKH625 ....................................................................................... 20
$GGLQJDQ2EMHFWXVLQJ$GG2EMHFW%XWWRQ ...................................................... 20
'HQLQJWKH2EMHFW0DQXDOO\ ........................................................................... 20
$GGLQJ2EMHFWVWKURXJK2EMHFW6S\.................................................................. 22
1DYLJDWHDQG/HDUQ ................................................................................................... 23
Other Object-Related Features of OR........................................................................ 25
/RFDWLQJWKH2EMHFWLQ25................................................................................. 27
8SGDWLQJDQ2EMHFWIURPWKH$SSOLFDWLRQ ......................................................... 27
2EMHFW5HSRVLWRU\3DUDPHWHUV253 ........................................................................ 28
,PSRUWLQJDQG([SRUWLQJ25IURP;0/ .................................................................. 32
8SGDWHIURP/RFDO2EMHFW5HSRVLWRU\...................................................................... 33
5HVROYLQJ&RQLFWVGXULQJWKH0HUJH ............................................................... 36
2EMHFW5HSRVLWRU\0HUJH7RRO................................................................................... 39
2EMHFW5HSRVLWRU\&RPSDULVRQ7RRO ......................................................................... 40
Local OR vs Shared OR ............................................................................................ 41
60$57,GHQWLFDWLRQ................................................................................................ 42
'LVDEOLQJ60$57,GHQWLFDWLRQ ....................................................................... 49
/RDGLQJ625DW5XQWLPH ......................................................................................... 52
/RDGLQJ625DW'HVLJQWLPH..................................................................................... 53
http://KnowledgeInbox.com/store/
473'HVFULSWLYH3URJUDPPLQJ8QSOXJJHG
http://KnowledgeInbox.com/store/
Bo
ok
Pr
ev
i
ew
2EMHFW,GHQWLFDWLRQ .................................................................................................. 55
Object Spy ......................................................................................................... 56
,PSOLFLWDQG([SOLFLW3URSHUWLHV ......................................................................... 58
:KHQWRXVH'HVFULSWLYH3URJUDPPLQJ ..................................................................... 59
'HVFULSWLYH3URJUDPPLQJ6\QWD[ .............................................................................. 60
8VLQJ'HVFULSWLRQ2EMHFWV................................................................................. 60
7KHPLFFODVV,GHQWLHU ...................................................................................... 63
8VLQJ'HVFULSWLRQ6WULQJV................................................................................. 63
(QXPHUDWLQJ&KLOG2EMHFWV......................................................................................... 64
&XVWRP&KHFN3RLQWV.................................................................................................. 66
&KHFN7HVW2EMHFW([LVWHQFH .................................................................................... 67
8VLQJ([LVW ....................................................................................................... 67
8VLQJ&KLOG2EMHFWV .......................................................................................... 68
&RQYHUWLQJDQ25EDVHG6FULSWWRD'3EDVHG6FULSW ............................................... 69
8VLQJD9%6FULSW'32EMHFW5HSRVLWRU\ ................................................................... 72
3UREOHPVZLWK2UGLQDO,GHQWLHUV.............................................................................. 73
:RUNLQJZLWK0XOWLSOH%URZVHUV .............................................................................. 75
%URZVHU,GHQWLFDWLRQ,VVXHV ..................................................................................... 77
&RPPRQ0LVWDNHVZKLOHXVLQJ'3 ........................................................................... 79
:ULWLQJ'3&RGHXVLQJ+70/6RXUFH&RGH ............................................................ 82
7HVW2EMHFW2YHUULGH .................................................................................................. 86
2EMHFW5HIHUHQFHV8QXVDEOHDIWHU1DYLJDWLRQ ........................................................... 86
$0\WKDERXW'3 ....................................................................................................... 87
2EMHFW&DVWLQJ ........................................................................................................... 88
3HUIRUPLQJDQ$FWLRQRQ0XOWLSOH2EMHFWV................................................................ 88
8VLQJ'HVFULSWLYH3URJUDPPLQJLQ6FULSWV ............................................................... 91
.H\ZRUGEDVHG'HVFULSWLYH3URJUDPPLQJ2EMHFW5HSRVLWRU\ ................................. 93
,PSOHPHQWLQJWKH.H\ZRUGEDVHG2EMHFW5HSRVLWRU\....................................... 94
,QVWDQWLDWLQJD7HVW2EMHFW ................................................................................. 96
8VLQJWKH2EMHFW5HSRVLWRU\ ............................................................................. 97
6WRULQJWKH2EMHFW5HSRVLWRU\ ........................................................................... 98
(QKDQFLQJWKH.H\ZRUGEDVHG2EMHFW5HSRVLWRU\ .................................................... 99
$OORZLQJ0XOWLSOH2EMHFW'HQLWLRQV ............................................................... 99
xvi
xvi
http://KnowledgeInbox.com/store/
Contents
http://KnowledgeInbox.com/store/
4. 9LVXDO5HODWLRQ,GHQWLHUV ..........................................................113
&UHDWLQJ9LVXDO5HODWLRQ,GHQWLHUVXVLQJ&RGH...................................................... 121
5. ChildObjects ................................................................................123
ew
ev
i
Bo
ok
Pr
Introduction.............................................................................................................. 133
:KHQWR8VH+70/'20 ...................................................................................... 134
:KHQ1RWWR8VH+70/'20 ............................................................................... 136
+70/'202EMHFWV............................................................................................... 136
+70/1RGH .................................................................................................... 136
7KH'RFXPHQW2EMHFW...................................................................................... 136
+70/(OHPHQW2EMHFW .................................................................................... 137
+70/(OHPHQWV&ROOHFWLRQ ............................................................................ 137
Link and Button (Click)................................................................................... 138
7H[WER[ ............................................................................................................ 139
&RPER%R[RU/LVWER[ ................................................................................... 140
Checkbox ......................................................................................................... 140
Radio Group .................................................................................................... 141
+70/7DEOH .................................................................................................... 141
%LQGLQJWRDQ(OHPHQWXVLQJ+70/'20 ............................................................. 142
&RQYHUWLQJD'202EMHFWWRD4737HVW2EMHFW .................................................... 144
7UDYHUVLQJ+70/7UHH1RGHV................................................................................. 145
&KHFNLQJ$SSHDUDQFHXVLQJ6W\OH6KHHWV ................................................................ 147
&KHFNLQJ2EMHFW9LVLELOLW\ .............................................................................. 147
http://KnowledgeInbox.com/store/
xvii
473'HVFULSWLYH3URJUDPPLQJ8QSOXJJHG
http://KnowledgeInbox.com/store/
7. 9LVXDO5HODWLRQ,GHQWLHUVXVLQJ+70/'20 ........................157
8. WebTables ....................................................................................167
:HE7DEOH,GHQWLFDWLRQLQ473 .............................................................................. 167
)LQGLQJD5RZZLWK6SHFLHG7H[W.......................................................................... 171
3HUIRUPLQJ2SHUDWLRQVRQ2EMHFWV,QVLGHWKH7DEOH ................................................ 172
)LQGLQJD5RZ&RQWDLQLQJ6SHFLF7H[W ............................................................... 173
&OLFNLQJ,QVLGHD:HE7DEOH ..................................................................................... 176
$V\QFKURQRXV7DEOH/RDGLQJ .................................................................................. 177
5HWULHYLQJWKH3DUHQW:HE7DEOHIURPDQ(OHPHQW .................................................. 178
ew
Pr
ev
i
Introduction.............................................................................................................. 197
8VLQJD6HSDUDWH)XQFWLRQ/LEUDU\IRUHDFK/RFDOH ................................................ 203
8VLQJD6LPSOH/RFDOH&ROOHFWLRQ ........................................................................... 205
8VLQJD7DEOHEDVHG/RFDOH0DS............................................................................. 209
8VLQJD6LPSOH&ODVVEDVHG'HOLPLWHG&ROOHFWLRQ .................................................. 213
8VLQJD&ODVVEDVHG&HQWUDOL]HG'HOLPLWHG&ROOHFWLRQ ........................................... 217
ok
Bo
Introduction.............................................................................................................. 223
$XWRPDWLF;3DWK;3DWK/HDUQHGDW5HFRUG7LPH................................................ 226
/HDUQLQJ;3DWKRQ)LUHIR[ ...................................................................................... 227
;3DWK([SUHVVLRQV:LOGFDUGV2SHUDWRUVDQG)XQFWLRQV ...................................... 229
Wildcards ......................................................................................................... 229
Operators ......................................................................................................... 230
;3DWK)XQFWLRQV .............................................................................................. 231
,PSOHPHQWLQJ;3DWKLQ473 ................................................................................... 232
6HOHFWLQJ1RGHV ............................................................................................... 232
6HOHFWLQJ3DUHQW1RGHVXVLQJ&KLOGUHQ ........................................................... 237
8VLQJ0DQXDO;3DWKZLWK2EMHFW5HSRVLWRU\ ......................................................... 238
;3DWK$[HV .............................................................................................................. 240
8QGHUVWDQGLQJ;3DWK$[HV.............................................................................. 241
xviii
xviii
http://KnowledgeInbox.com/store/
Contents
http://KnowledgeInbox.com/store/
12. 2EMHFW,GHQWLFDWLRQXVLQJ&66...............................................253
7HVWLQJ&666HOHFWRUVZLWK)LUH3DWK ....................................................................... 258
ew
Pr
ev
i
ok
15. 7HVWLQJ:HE6HUYLFHV.................................................................287
Bo
Introduction.............................................................................................................. 287
$6LPSOH7HPSHUDWXUH&RQYHUVLRQ:HE6HUYLFH..................................................... 289
7HVWLQJ:HE6HUYLFHVXVLQJWKH:HE6HUYLFH$GGLQ .............................................. 293
Installation ....................................................................................................... 293
:HE6HUYLFHV7HVWLQJ:L]DUG .......................................................................... 297
9HULI\LQJ;0/5HVSRQVH9DOXHV .................................................................... 308
:HE6HUYLFH2EMHFW0HWKRGV ........................................................................... 309
7HVWLQJ:HE6HUYLFHV3URJUDPPDWLFDOO\ ................................................................. 311
;0/+7735HTXHVW ......................................................................................... 312
3DUVLQJ5HVSRQVHZLWK;0/8WLO..................................................................... 315
3DUVLQJ5HVSRQVHZLWK;0/'20 ................................................................. 316
7HVWLQJ62$35HTXHVWDQG5HVSRQVH...................................................................... 320
16. &RGLQJ6FULSWVLQ1(7.............................................................323
http://KnowledgeInbox.com/store/
xix
473'HVFULSWLYH3URJUDPPLQJ8QSOXJJHG
http://KnowledgeInbox.com/store/
473
V&RPPXQLFDWLRQZLWKDQ2XWRI3URFHVV&202EMHFW ................................. 323
(YHU\2EMHFWLQ473LVD&202EMHFW ........................................................... 325
4731(7&20%ULGJH .......................................................................................... 325
9%1(7&20%ULGJH ............................................................................................. 329
,QWHOOL6HQVHLQ1(7,'( ......................................................................................... 336
ew
Introduction.............................................................................................................. 339
7KH&RPSDQ\/LVW$SSOLFDWLRQ................................................................................ 341
Installation ............................................................................................................... 344
5HFRUGLQJD7HVW:LWKRXW:HE$GGLQ([WHQVLELOLW\ ............................................... 347
'HYHORSLQJ7RRONLW6XSSRUW6HWZLWK([WHQVLELOLW\$FFHOHUDWRU ............................. 349
([WHQVLELOLW\LQ'HSWK .............................................................................................. 378
/LPLWDWLRQVDQG,VVXHV ............................................................................................. 390
ev
i
Pr
Introduction.............................................................................................................. 393
+RZWR&UHDWH5HVHUYHG2EMHFWV ............................................................................. 394
&UHDWLQJDQ,FRQIRUWKH5HVHUYHG2EMHFW................................................................ 397
Bo
ok
xx
http://KnowledgeInbox.com/store/
Contents
http://KnowledgeInbox.com/store/
$SSHQGL[&;3DWKYV&66 ...........................................................423
$SSHQGL['1HVWLQJRI5HJLVWHU8VHU)XQF0HWKRGV..................427
$SSHQGL[((YDODQG([HFXWH .....................................................433
Bo
ok
Pr
ev
i
ew
$SSHQGL[)&URVV%URZVHU7HVWV ................................................437
http://KnowledgeInbox.com/store/
xxi
Preface
http://KnowledgeInbox.com/store/
Preface
Test Automation plays a crucial role in Software Development Lifecycle. With businesses
around the world pushing their IT teams to release software faster and sooner, Test
Automation has become an essential part of the testing lifecycle. Test Automation helps
perform redundant and repeatable tests against the application using an Automation tool.
QuickTest Professional (QTP), otherwise known as Functional Testing (FT) is one such
tool being used in the Test Automation domain.
QTP offers support for functional automation of various platforms:
ew
x Web
x VB
ev
i
x Windows
x ActiveX
Pr
x JAVA
x .NET
x Siebel
Bo
x SAP
ok
x WPF
x Peoplesoft
x Oracle
x PowerBuilder
x Stringray
x Terminal Emulators
x VisualAge Smalltalk
473 VXSSRUWV WKHVH WHFKQRORJLHV XVLQJ DQ H[WUHPHO\ ZHOO ODLGRXW 2EMHFW ,GHQWLFDWLRQ
PHFKDQLVPDUFKLWHFWXUHSURYLGLQJXVHUVZLWKDVHWRISUHGHQHGREMHFWW\SHVDQGSURSHUWLHV
http://KnowledgeInbox.com/store/
xxiii
http://KnowledgeInbox.com/store/
IRUWKHJLYHQWHFKQRORJ\DQGLWVFRUUHVSRQGLQJREMHFWV,GHQWLFDWLRQDJDLQVWWHVWREMHFWV
is performed by storing a set of known properties directly related to the type of object. For
H[DPSOHWRLGHQWLI\DWH[WER[LQDZHESDJH473GHQHVWKHREMHFWW\SHDV:HE(GLWDQG
some of the common properties to identify such an object are html tag, type, id and name.
ew
7KH473LGHQWLFDWLRQPHFKDQLVPZRUNVSHUIHFWO\DVORQJDVWKHDSSOLFDWLRQXQGHUWHVW
exposes test objects in such a way that its add-ins identify the interface presented by
the underlying technology. If the relevant add-in is not associated with the test or if the
ZD\VWHVWREMHFWVDUHH[SRVHGGRQRWPHHWWKHFULWHULDIRU2EMHFW,GHQWLFDWLRQ473IDLOV
WR LGHQWLI\ REMHFWV FRUUHFWO\$W WLPHV XQVXSSRUWHG REMHFWV DUH GHQHG XVLQJ D JHQHULF
WinObject. In such cases, certain workarounds must be implemented to enable QTP to
accurately identify objects.
ev
i
(YHQ D VPDOO REMHFW LGHQWLFDWLRQ LVVXH FDQ EHFRPH D PDMRU SUREOHP ,W LV WKHUHIRUH RI
the utmost importance to understand how to work around the features of the tool and to
consider the options available to overcome the issue.
Bo
ok
Pr
7KHSULPDU\IRFXVRIWKLVERRNLV2EMHFW,GHQWLFDWLRQZLWK4737KLVERRNSODFHVJUHDW
emphasis upon how to tackle the challenges one faces when implementing a real-life project.
To illustrate, consider a page which presents a textbox generated at run-time and which has
a dynamic NAME property; the propertys value changes during each run-session. This can
SRVHDJUHDWFKDOOHQJHLQLGHQWLFDWLRQDVWKHUHPD\EHQRXQLTXHSURSHUW\ZLWKZKLFKWR
LGHQWLI\WKHREMHFWRUWKHDYDLODEOHSURSHUWLHVPD\QRWEHVXIFLHQWIRUDUREXVWGHVFULSWLRQ
Hence it is important to be able to understand the implementation and also to come up
with a robust description. This book will walk you through such real-life scenarios and
LPSOHPHQWDWLRQLVVXHVZKLOHSURYLGLQJVHYHUDOUHVROXWLRQWHFKQLTXHV
The book also covers Descriptive Programming and Object Repository concepts in depth
and walks the reader through some of the really innovative ways in which these can be used
IRU2EMHFW,GHQWLFDWLRQDQG7HVW,PSOHPHQWDWLRQ
This book is written by two seasoned experts from the QTP community, Tarun Lalwani,
who has published several other books (including the renowned QuickTest Professional
Unplugged) on QTP and is the founder of the website KnowledgeInbox, and Anshoo Arora,
the founder of Relevant Codes, a website with focus on Test Automation. Both authors
xxiv
http://KnowledgeInbox.com/store/
Preface
http://KnowledgeInbox.com/store/
have worked for different international clients and have extensive real-time experience in
Test Automation.
ew
feedback@knowledgeinbox.com
www.KnowledgeInbox.com/contact-us/
ZZZIDFHERRNFRPTWSGSXQSOXJJHGERRN
ev
i
Email:
Website:
Facebook:
Pr
The source codes used in the book can be downloaded from: www.KnowledgeInbox.com/
demos/QTPDPUnplugged_SourceCodes.zip
ok
Bo
http://KnowledgeInbox.com/store/
xxv
http://KnowledgeInbox.com/store/
Pr
ev
i
ew
Introduction to Objects
Bo
ok
Believe it or not, our lives are surrounded by objects. From small to large, we encounter
a huge variety of objects of various types on a daily basis. The neurons in our brain use
information from our different senses, such as vision, smell, hearing and touch, to help us
identify an object. In fact, the human brain works pretty seamlessly in performing this task.
But for a normal computer program to match that power is not easy.
,QRUGHUWRDXWRPDWHDSSOLFDWLRQVRQHRIWKHPRVWFUXFLDOHOHPHQWVLV2EMHFW,GHQWLFDWLRQ
This is one of the tough challenges that Automation Engineers face around the world with
various automation tools; any application can pose a challenge different in nature to any
other application.
In object-driven automation, events against objects can only be executed if the software
LV DEOH WR FRUUHFWO\ LGHQWLI\ WKRVH REMHFWV ,I WKH VRIWZDUH IDLOV LQ 2EMHFW ,GHQWLFDWLRQ
WKHDSSOLFDWLRQEHFRPHVLPSRVVLEOHWRDXWRPDWH2EMHFW,GHQWLFDWLRQLVWKHUHIRUHDFRUH
FRQFHSWLQ7HVW$XWRPDWLRQ0RUHRYHUWKHZD\DQREMHFWLVLGHQWLHGPRVWO\GHSHQGVRQ
the technology that is used to implement the object. Consider the Windows Run window
as shown in the image below:
http://KnowledgeInbox.com/store/
http://KnowledgeInbox.com/store/
Bo
ok
Pr
ev
i
ew
Our aim is to click the Cancel button. When we spy the Cancel button using QTPs Object
6S\LWLGHQWLHVDKLHUDUFK\RIREMHFWVZLWKWKH5XQZLQGRZDVWKHURRWREMHFWDQGWKH
Cancel button as the child of the Run window.
http://KnowledgeInbox.com/store/
1 Introduction to Objects
http://KnowledgeInbox.com/store/
QTP is able to identify the Cancel button we wanted to click. Now we can add this object
to the Object Repository and perform the click using the following code:
Dialog("Run").WinButton("Cancel").Click
Bo
ok
Pr
ev
i
ew
This works because QTP internally knows how to recognize a native Windows object. QTP
does this through the use of the corresponding add-ins. Every technology is represented
as an individual add-in. When QTP is launched, it provides a list from which to select the
relevant add-ins through the Add-in Manager.
http://KnowledgeInbox.com/store/
NOTE:
http://KnowledgeInbox.com/store/
required.
Pr
ev
i
ew
To demonstrate how the technology behind the GUI makes a difference, we have created a
Java GUI for the same Run window we used earlier in this chapter:
ok
Now if we Spy the same Cancel button again using QTPs Object Spy, we will notice one
crucial difference as shown in Figure 1.5 Object Spy - Java Run Command window.
Bo
QTP is only able to identify the top level window and nothing inside the window. This
PDNHVFOLFNLQJRQWKH&DQFHOEXWWRQGLIFXOWDVZHFDQQRWLGHQWLI\LWDVDXQLTXHREMHFW
The reason this is because the Java add-in is not loaded during startup. There may be
circumstances when QTP may fail regardless of the add-in selected. In such a case, we
PXVWLPSOHPHQWZRUNDURXQGVVXFKDVQGLQJWKHORFDWLRQRIWKH&DQFHOEXWWRQDQGXVLQJ
LWVFRRUGLQDWHVWRUHDPRXVHFOLFNHYHQW1RZOHWXVORDGWKH-DYDDGGLQGXULQJ473
startup as shown in Figure 1.6 Loading Java Add-in at startup
When we use the Object Spy again on the Run window made in Java, we will be able to
identify the objects inside the Run window as shown in Figure 1.7 Object Spy for Java
Run window after loading Java Add-in
http://KnowledgeInbox.com/store/
1 Introduction to Objects
Bo
ok
Pr
ev
i
ew
http://KnowledgeInbox.com/store/
http://KnowledgeInbox.com/store/
Bo
ok
Pr
ev
i
ew
http://KnowledgeInbox.com/store/
http://KnowledgeInbox.com/store/
1 Introduction to Objects
Bo
ok
Pr
ev
i
ew
http://KnowledgeInbox.com/store/
Figure 1.7 Object Spy for Java Run window after loading Java Add-in
One such example is the max length, where the SAP GUI scripting engine returns the max
length of a control as the length of text present in the control. This causes QTP to fail when
performing a set operation if the text being set is bigger than the text already present. The
SAP OSS note 1460861 - Scripting: MaxLength property returns wrong value describes
the issue.
Similarly, the Siebel add-in uses the SIEBEL Automation API for interacting with the
http://KnowledgeInbox.com/store/
http://KnowledgeInbox.com/store/
ew
ev
i
Pr
You may have already heard that it is necessary to launch QTP before starting your
DSSOLFDWLRQ7KHUHDVRQEHKLQGWKDWUHTXLUHPHQWLVWKDWZKHQ473LVODXQFKHGLWSODFHV
FHUWDLQ KRRNV LQ WKH V\VWHP HDFK RI ZKLFK LV WDUJHWHG IRU D VSHFLF DSSOLFDWLRQ ,I WKH
application is launched before QTP, then these hooks will not be present in the application
and QTP will not be able to communicate with the application in the way intended.
ok
However, this is not true for all applications or add-ins. Consider a few of the known
exceptions:
Bo
http://KnowledgeInbox.com/store/
1 Introduction to Objects
Bo
ok
Pr
ev
i
ew
http://KnowledgeInbox.com/store/
Figure 1.8 - DLL's loaded into Internet Explorer with QTP open
The SAP add-in uses SAP Scripting GUI and therefore a SAP GUI application will
VWLOOEHLGHQWLHGFRUUHFWO\HYHQLIODXQFKHGEHIRUH473
http://KnowledgeInbox.com/store/
http://KnowledgeInbox.com/store/
Pr
ev
i
Object Repository
ew
Bo
ok
2EMHFW,GHQWLFDWLRQLVWKHNH\FRQFHSWWRXQGHUVWDQGLQJWKHUHVWRIWKLVERRN(YHU\WKLQJ
ZHZLOOUHDGLQWKLVERRNLVFRQFHUQHGZLWK2EMHFW,GHQWLFDWLRQXVLQJWHFKQLTXHVVXFKDV
2EMHFW5HSRVLWRU\25DQG'HVFULSWLYH3URJUDPPLQJ'3%XWEHIRUHZHGLYHLQWRWKH
GHWDLOVRI25DQG'3LWVLPSRUWDQWWRXQGHUVWDQGWKHFRQFHSWRILGHQWLFDWLRQDQGKRZ
H[DFWO\LWZRUNV
:KHQZHUHFRUGDVFULSWLQ473LWPRQLWRUVDOOHYHQWVWKDWKDSSHQLQWKHV\VWHP%DVHG
RQ473VFRQJXUDWLRQDQGWKHDGGLQVORDGHGLQLWVPHPRU\VRPHRIWKHVHHYHQWVDUH
FDSWXUHG LQ WKH WHVW VFULSW 1RW DOO HYHQWV JHW UHFRUGHG HJ PRXVH PRYHPHQWV DUH QRW
FDSWXUHG LQ FRQWH[W VHQVLWLYH DQG ORZOHYHO UHFRUGLQJ:KHQ 473 UHFRUGV DQ HYHQW WKH
IROORZLQJSURFHVVRFFXUV
$GGLQJRIREMHFWVWR25ZLWKDORJLFDOQDPHZKLFKLVQHFHVVDU\IRUUHSOD\
$GGLQJRILGHQWLFDWLRQSURSHUWLHVWRREMHFWVLQWKH25VR473FDQLGHQWLI\WKH
REMHFWGXULQJUHSOD\
*HQHUDWLQJDFRGHVWDWHPHQWVLQ473ZKLFKFRQVLVWVRI2EMHFW$FWLRQDQG'DWD
)RUH[DPSOHLQWKHEHORZVWDWHPHQW
http://KnowledgeInbox.com/store/
11
3 Descriptive Programming
http://KnowledgeInbox.com/store/
dpBtnLogin = "name:=Login,index:=0"
'RLQJVRZLOODVN473WRLGHQWLI\DQREMHFWZKLFKKDVQDPHDV/RJLQLQGH[ 7KLVLVD
common mistake that is often made by novice users of DP. Instead of using a string based
DP, we need to use object-based DP. We can update the library as follows:
Set dpBtnLogin = Description.Create
dpBtnLogin("name").value = "Login"
dpBtnLogin("index").value = 0
ew
The above uses a hybrid of string-based and object-based DP. Using string-based DP means
using less memory and shorter code, while using object-based DP means higher memory
and lengthier code but less maintenance in scripts. This is because it allows adding multiple
SURSHUWLHVWRWKHGHVFULSWLRQDQGGRHVQWUHTXLUHDQ\PRGLFDWLRQWRWKHVFULSW
Pr
ev
i
7KLV DSSURDFK ZRUNV ZHOO ZKHQ WKH QXPEHUV RI REMHFWV LQ WKH DSSOLFDWLRQ LV VPDOO %XW
ZKHQWKHQXPEHURIREMHFWVLQFUHDVHVWKHOLEUDU\VL]HDOVRLQFUHDVHVPDNLQJLWGLIFXOWWR
PDLQWDLQDQGORRNXSREMHFWV$GGLWLRQDOO\EHFDXVHDOOREMHFWGHQLWLRQVDUHLQWKHVDPH
OLEUDU\WKHOLEUDU\FDQWEHXSGDWHGE\PXOWLSOHXVHUVDWWKHVDPHWLPH7RRYHUFRPHWKLV
we will create a Keyword-based Object Repository.
ok
Bo
http://KnowledgeInbox.com/store/
93
http://KnowledgeInbox.com/store/
ew
/HWVVHHKRZRXUVDPSOH2EMHFW5HSRVLWRU\ZRXOGORRNOLNH
ev
i
ok
Pr
&@AJPEANO>QPUKQ?=J=@@=JUJQI>ANKB?KHQIJOPK>QEH@
unique descriptions. However, we recommend a maximum
KB E@AJPEANO &@A=HHU OLA=GEJC
PDA JQI>AN KB E@AJPEANO
should be 2-3.
Bo
Next, we will explore a few different aspects of implementing this approach of building a
custom Object Repository.
94
http://KnowledgeInbox.com/store/
3 Descriptive Programming
http://KnowledgeInbox.com/store/
End Class
To maintain the object repository we will use a Dictionary object to store the information
about each test object. Keys of the Dictionary will store the keywords whereas the items
will store the target test objects as shown here:
'Create dictionary for storing objects in object repository
Dim ObjectRepository
Set ObjectRepository = CreateObject("Scripting.Dictionary")
Pr
ev
i
ew
Bo
ok
In order to make our object repository case-insensitive, we simply add the next line of code
after creating the Dictionary:
'Set text compare mode for keyword for object to be incase-sensitive
ObjectRepository.CompareMode = vbTextCompare
NOTE:
http://KnowledgeInbox.com/store/
95
http://KnowledgeInbox.com/store/
Pr
ev
i
ew
3EOQ=H/AH=PEKJ&@AJPEANO
Bo
ok
473 LQWURGXFHG D QHZ W\SH RI 2EMHFW ,GHQWLFDWLRQ PHFKDQLVP NQRZQ DV 9LVXDO
5HODWLRQ,GHQWLHUV95,$VWKHQDPHVXJJHVWVWKLVPHFKDQLVPXVHVYLVXDOUHODWLRQVKLSV
EHWZHHQ WZR RU PRUH REMHFWV WR XQLTXHO\ LGHQWLI\ WKH WDUJHW REMHFW %HIRUH VHHLQJ KRZ
WKLVLGHQWLFDWLRQZRUNVZHZLOOUVWVHHDVLWXDWLRQZKHUHWKLVIHDWXUHPD\EHUHTXLUHG
&RQVLGHUWKHH[DPSOHEHORZ
http://KnowledgeInbox.com/store/
113
http://KnowledgeInbox.com/store/
ok
Pr
ev
i
ew
ChildObjects
Bo
http://KnowledgeInbox.com/store/
123
http://KnowledgeInbox.com/store/
Pr
ev
i
ew
HTML DOM
ok
Introduction
Bo
The HTML DOM is a Document Object Model for representing HTML documents. DOM
LVD:&VWDQGDUGZKLFKLVSODWIRUPDQGODQJXDJHLQGHSHQGHQWDQGGHQHVDVWDQGDUG
set of objects in a tree structure of elements. It provides a standard approach to access and
manipulate HTML documents. All elements, along with their text and attributes can be
accessed and manipulated through the DOM tree.
The QTP Page objects .Object property provides access to the HTML DOM:
'Get the DOM document object
Set oDocument = Browser("Browser").Page("Page").Object
http://KnowledgeInbox.com/store/
133
http://KnowledgeInbox.com/store/
Pr
ev
i
ew
3EOQ=H/AH=PEKJ&@AJPEANOQOEJC%1*)
!,*
Bo
ok
A limitation of 9LVXDO5HODWLRQDO,GHQWLHUVLVWKDWLWFDQQRWEHXVHGZLWKSURJUDPPDWLF
GHVFULSWLRQV 1RW DOO DXWRPDWLRQ IUDPHZRUNV XVH WKH 2EMHFW 5HSRVLWRU\ VR PDNLQJ XVH
RI 9LVXDO 5HODWLRQ ,GHQWLHUV 95, IRU 2EMHFW ,GHQWLFDWLRQ LQ D :HE HQYLURQPHQW
LV QRW SRVVLEOH RXWRIWKHER[7KHUH LV KRZHYHU D ZRUNDURXQG XVLQJ +70/ '20 DV
GHPRQVWUDWHGLQWKLVVHFWLRQ
:HXVHWKHIROORZLQJ'20SURSHUWLHVWRWUDYHUVHQRGHV
!,*-NKLANPU
childNodes
UVW&KLOG
ODVW&KLOG
QH[W6LEOLQJ
SDUHQW1RGH
!AO?NELPEKJ
5HWULHYHV D FROOHFWLRQ RI +70/ HOHPHQWV DQG 7H[W1RGH REMHFWV
WKDWDUHLPPHGLDWHGHVFHQGDQWVRIWKHWDUJHW
5HWULHYHVWKHUHIHUHQFHWRWKHUVWFKLOGLQWKHFKLOG1RGHVFROOHFWLRQ
5HWULHYHVWKHUHIHUHQFHWRWKHODVWFKLOGLQWKHFKLOG1RGHVFROOHFWLRQ
5HWULHYHVWKHUHIHUHQFHWRWKHIROORZLQJQRGHRIWKHWDUJHWZKLFKLV
DOVRWKHQH[WFKLOGRIWKHVDPHSDUHQWDVWKHWDUJHW
5HWULHYHVWKHUHIHUHQFHWRWKHSDUHQWREMHFWRIWKHWDUJHW
http://KnowledgeInbox.com/store/
157
http://KnowledgeInbox.com/store/
ok
Pr
ev
i
ew
WebTables
Bo
A huge amount of testing today is done on Web/HTML. A TABLE tag in HTML can be
used to present data or perform layouts on the webpage. This chapter will focus on some of
the key tasks that need to be performed when dealing with WebTables. But before we start
ZLWKWKHVHWDVNVZHZDQWWRGLVFXVV:HE7DEOHLGHQWLFDWLRQ
4A>1=>HA&@AJPE?=PEKJEJ.1:KHQZHDGGD:HE7DEOHREMHFWWRWKH2EMHFW5HSRVLWRU\25LWLGHQWLHVWKHREMHFW
XVLQJWKH,QGH[2UGLQDO,GHQWLHUDVVKRZQLQWKHLPDJHEHORZ
http://KnowledgeInbox.com/store/
167
8 WebTables
http://KnowledgeInbox.com/store/
#EJ@EJC=/KS KJP=EJEJC0LA?E?1ATP
ok
Pr
ev
i
ew
We saw earlier how the GetRowWithCellText method provides us with a way to search for
VSHFLFWH[WSUHVHQWLQWKHFHOO%XWWKHUHLVQRPHWKRGZKLFKDOORZVXVWRVHDUFKDURZZLWK
WH[WLQPXOWLSOHFROXPQVRIWKHWDEOH&RQVLGHUWKHIROORZLQJWDEOH
Figure 8.3'HPRZHESDJH
Bo
bFound = False
iStartRow = 1
Do
iRow = Browser("Browser").Page("Page").WebTable("Book").
GetRowWithCellText("QuickTest Professional Unplugged",1, iStartRow)
If iRow = -1 Then
bFound = False
bExit = True
Else
'Next time we will search for one row further
http://KnowledgeInbox.com/store/
173
http://KnowledgeInbox.com/store/
Pr
ev
i
ew
Bo
ok
Previously in web-design, UI Designers used the TABLE tags to create a tabular look and
feel. This TABLE tag implementation makes it easier for Automation Engineers to process
data and perform actions on objects inside the table. Consider the following table:
http://KnowledgeInbox.com/store/
181
http://KnowledgeInbox.com/store/
10
Pr
ev
i
ew
ok
Introduction
Bo
$V DSSOLFDWLRQV EHFRPH JOREDO DGDSWLQJ WKHP WR VSHFLF FXOWXUHV RU ORFDOHV EHFRPHV D
PDVVLYHWDVN<RXPD\KDYHYLVLWHGZHEVLWHVWKDWSURYLGHVLWVXVHUV WRFRQYHUWWKHEDVH
ORFDOWH[WWRWKHWH[WRIWKHORFDOHFKRVHQ)RUH[SODQDWLRQDQGVLPSOLFLW\WKLVERRNXVHVD
[HG+70/VFKHPHIRU(QJOLVKDQG6SDQLVKIRUWKHGHPRQVWUDWLRQRIWHFKQLTXHVWKDWFDQ
VLPSOLI\ORFDOL]DWLRQWHVWLQJ
%HORZLVDOLVWRIVRPHFRPPRQO\XVHGORFDOHV
Locale Description
$IULNDDQV
$UDELF8QLWHG$UDE(PLUDWHV
&KLQHVH&KLQD
&KLQHVH+RQJ.RQJ
http://KnowledgeInbox.com/store/
197
/RFDOL]DWLRQ7HFKQLTXHVDQG'HVLJQ3DWWHUQV
http://KnowledgeInbox.com/store/
Dim path
LoadFunctionLibrary path
End Sub
7KHIROORZLQJFRGHZLOOEHXVHGWRORDGWKHORJLQYEVOLEUDU\ZLWK(QJOLVKORFDOH
LoadLocaleLib "login.vbs", "en-us" 'English
7KHFRGHEHORZZLOOEHXVHGWRORDGWKHORJLQYEVOLEUDU\ZLWK6SDQLVKORFDOH
ew
7KHDERYHORDGLQJPHFKDQLVPFDQHLWKHUEHVWRUHGLQDWHVWRULQDQDVVRFLDWHGIXQFWLRQ
OLEUDU\UHFRPPHQGHG
Advantages
Bo
(DV\WRXVH
ok
Pr
ev
i
(YHQWKRXJKWKLVWHFKQLTXHLVYHU\HDV\WRXVHLWKDVTXLWHDKLJKPDLQWHQDQFHRYHUKHDG
EHFDXVHWKHVDPHFRS\RIWKHOLEUDU\ZLWKGLIIHUHQWORFDOHVH[LVWVLQGLIIHUHQWORFDWLRQV
&KDQJHVPDGHWRWKHRZRIWKHDSSOLFDWLRQZLOOUHVXOWLQGHYHORSHUVLPSOHPHQWLQJWKH
XSGDWH LQ PXOWLSOH SODFHV +RZHYHU D ELJ PDLQWHQDQFH RYHUKHDG FDQ EH WUDGHG IRU D
VLWXDWLRQZKHUHFKDQJHVLQORFDOHDOVRUHVXOWVLQWKHFKDQJHRIRZRURYHUDOO8,GHVLJQ,Q
RWKHUZRUGVWKLVDSSURDFKPDNHVLWHDVLHUWRDFFRPRGDWHIRUVLWXDWLRQVZKHUHFRGHORJLF
FKDQJHVIURPRQHORFDWHWRDQRWKHU
3URYLGHVH[LELOLW\LQVLWXDWLRQVZKHUHRZGLIIHUVIURPORFDOHWRORFDOH
'LVDGYDQWDJHV
3RRUPDLQWHQDQFHFKDQJHVPDGHWRRQHOLEUDU\PXVWEHFRSLHGWRDOORWKHUOLEUDULHV
&UHDWLQJOLEUDULHVIRUHDFKORFDOHFDQEHDWLPHFRQVXPLQJSURFHVV
http://KnowledgeInbox.com/store/
205
/RFDOL]DWLRQ7HFKQLTXHVDQG'HVLJQ3DWWHUQV
http://KnowledgeInbox.com/store/
IXQFWLRQDOLW\
'Test: Action1
main_Page.Run
main_Page.Run
8QOLNHWKHSUHYLRXVDSSURDFKHVWKLVPHWKRGGRHVQRWXVHDJOREDOYDULDEOHWRGHQHWKH
ORFDOHWRWHVWDJDLQVW7KLVDSSURDFKSURYLGHVWKHH[LELOLW\WRGHQHWKHORFDOHDWDQ\JLYHQ
WLPHXVLQJ/RFDOH'HQH
Pr
ev
i
ew
(YHQ WKRXJK WKLV DSSURDFK LV YHU\ PXFK OLNH WKH SUHYLRXV RQH ZLWK WKH GDWDVRXUFH LW
RPLWVWKHQHHGWRFUHDWHDQH[WHUQDOVRXUFHWRGHSHQGXSRQIHHGLQJWKHFRUUHFWGHVFULSWLRQV
7KLVPD\EHDGYDQWDJHRXVLQHQYLURQPHQWVZKHUHFUHDWLQJDVWDQGDORQHGDWDVRXUFHGRHV
QRWZRUNZHOOVHHWKH'LVDGYDQWDJHVVHFWLRQRIWKHSUHYLRXVDSSURDFK8VLQJD7DEOH
EDVHG/RFDOH0DS$OOSURSHUWLHVDUHVWRUHGZLWKLQWKHVDPH&ODVVDQGWKLVHQDEOHVD
VLQJOHORFDWLRQRIPDLQWHQDQFHIRUFKDQJHVLQRZDVZHOODVFKDQJHVLQORFDOHYHUELDJH
,QDGGLWLRQWKLVDSSURDFKDOVRHQDEOHVWHVWLQJPXOWLSOHORFDOHVRQWKHVDPH8,E\VLPSO\
FKDQJLQJWKHORFDOHGHQLWLRQDQGUXQQLQJWKHFRUUHFWPRGXOH
Advantages
ok
,WVXSSRUWVWHVWLQJPXOWLSOHORFDOHV
$OOGHVFULSWLRQVDUHVWRUHGZLWKLQWKHOLEUDU\
Bo
,WLVREMHFWEDVHG
'LVDGYDQWDJHV
7KHHQJLQHHUPXVWEHIDPLOLDUZLWK22WHFKQLTXHVWRXWLOL]HLWZHOO
%HFDXVH WKLV WHFKQLTXH DOVR XVHV GHOLPLWHUV DV WKH QXPEHU RI ORFDOHV LQFUHDVH
PDLQWHQDQFHFDQEHFRPHFXPEHUVRPHLQFDVHVZKHUHORFDOHVWULQJVDUHYHU\ORQJ
http://KnowledgeInbox.com/store/
217
473'HVFULSWLYH3URJUDPPLQJ8QSOXJJHG
http://KnowledgeInbox.com/store/
ev
i
ew
ok
Pr
Bo
Dim MainPage
Set MainPage = New MainPageClass
Class LoginPageClass
'Scripting.Dictionary built from LocalizedRepository
Private Content
218
http://KnowledgeInbox.com/store/
http://KnowledgeInbox.com/store/
11
Pr
ev
i
ew
,>FA?P&@AJPE?=PEKJQOEJC5-=PD
ok
&JPNK@Q?PEKJ
Bo
With QTP 11, HP launched several new web testing capabilities to provide engineers
ZLWK JUHDWHU H[LELOLW\ ZKHQ WHVWLQJ :HE DSSOLFDWLRQV 2QH RI WKH LPSRUWDQW DGGLWLRQV
ZDV;3DWKIRU2EMHFW,GHQWLFDWLRQDTXHU\ODQJXDJHIRUVHOHFWLQJQRGHVIURPDQ;0/
GRFXPHQW 473 DXWRPDWLFDOO\ JHQHUDWHV DQG DVVLJQV D ;3DWK ZKLOH UHFRUGLQJ REMHFWV
RQ:HE DSSOLFDWLRQV +RZHYHU WKLV ;3DWK LV XVHG LQ WKH EDFNJURXQG DV D SHUIRUPDQFH
HQKDQFHPHQWGXULQJWHVWH[HFXWLRQ
,I473LGHQWLHVWKHZURQJREMHFWXVLQJWKHJHQHUDWHG;3DWKWKHQLWIDOOVEDFNWRXVXDO
GHVFULSWLRQSURSHUWLHV7RIRUFH;3DWKEDVHGLGHQWLFDWLRQIRUDQREMHFWZHQHHGWRDGG
;3DWK DV RQH RI WKH GHVFULSWLRQ SURSHUWLHV LQ WKH 25 7R EH DEOH WR XVH ;3DWK EDVHG
LGHQWLFDWLRQKDYLQJDVRXQGXQGHUVWDQGLQJRI;3DWKLVKLJKO\UHFRPPHQGHG
http://KnowledgeInbox.com/store/
223
2EMHFW,GHQWLFDWLRQXVLQJ;3DWK
http://KnowledgeInbox.com/store/
<td>
<span>Row1 span1</span><br/>
<span id="selectednode">Row1 span2 <!-- target -->
<p>TEST</p>
<p>REST</p>
</span>
ancestor-or-self
XPath selector: //SPAN[@id='selectednode']/ancestor-or-self::*
ok
Pr
ev
i
ew
<html>
<body>
<div id="forsomereason">
<span>This is before table</span><br/>
</div>
<table border="1">
<tr>
<td>
<span>Row1 span1</span><br/>
<span id="selectednode">Row1 span2 <!-- target -->
<p>TEST</p>
<p>REST</p>
</span><br/>
Bo
child
descendant
XPath selector: //SPAN[@id='selectednode']/descendant::*
<span id="selectednode">Row1 span2 <!-- target -->
<p>TEST</p>
http://KnowledgeInbox.com/store/
243
http://KnowledgeInbox.com/store/
12
ok
Pr
ev
i
ew
,>FA?P&@AJPE?=PEKJQOEJC 00
Bo
$V ZH VDZ LQ WKH ;3DWK FKDSWHU 2EMHFW ,GHQWLFDWLRQ FDQ EH PDGH YHU\ H[LEOH HYHQ
RIIHULQJWKHDELOLW\WRXWLOL]HWKHXQLTXHHOHPHQWVWRLGHQWLI\WKHQRQXQLTXHRQHV-XVWOLNH
ZLWK;3DWKZHZLOOXVH&666HOHFWRUVWRLGHQWLI\REMHFWVE\GLUHFWO\ORFDWLQJWKHWDUJHW
QRGHDQGDOVRE\XVLQJDQHLJKERULQJQRGHDVDQDQFKRU
7KLVLVJRLQJWREHDIDPLOLDUWRSLFIRUDZHEGHYHORSHURUDQ\RQHZKRKDVH[SHULHQFHVW\OLQJ
ZHESDJHV$&666HOHFWRULVXVHGWRVW\OHDQHOHPHQWE\SRLQWLQJWRLWVWDJLQFRQMXQFWLRQ
ZLWKDQ\DWWULEXWHVDVVRFLDWHGZLWKWKDWWDJ7KHV\QWD[RIXVLQJD&666HOHFWRULQ473LV
VLPLODUWRXVLQJDQ\RWKHUSURSHUW\YDOXHSDLULQWKH2EMHFW,GHQWLFDWLRQVHSDUDWHGE\WKH
:=GHOLPLWHU
7KHIROORZLQJFRGHVWDWHPHQWVKRZV&66VHOHFWRUXVDJHIRUD:HE%XWWRQZLWKWKH+70/
7$*HTXDOV,1387DQG&/$66HTXDOVEWQ7DUJHW
Browser("CSS Chapter").WebButton("css:=input.btnTarget").Click
http://KnowledgeInbox.com/store/
253
http://KnowledgeInbox.com/store/
13
ok
Pr
ev
i
ew
ObjectRepositoryUtil
Bo
http://KnowledgeInbox.com/store/
265
http://KnowledgeInbox.com/store/
14
ok
Pr
ev
i
ew
Bo
http://KnowledgeInbox.com/store/
271
http://KnowledgeInbox.com/store/
15
ok
Pr
ev
i
ew
Bo
Introduction
As web services become key areas of enterprise applications, the focus on testing them has
become increasingly important. A web service is used to provide a response to a clients
request. The request and response are sent and received respectively using the Simple
Object Access Protocol (SOAP). To test a web service, an automation engineer must carry
out the following steps:
1. 'HQHWKHSDUDPHWHUVWRVXSSO\WRWKHZHEVHUYLFH
2. 6HQGWKHUHTXHVWZLWKWKHGHQHGLQSXWSDUDPHWHUV
3. Parse response to verify expected versus actual values.
The process of sending a request and receiving a response is shown below:
http://KnowledgeInbox.com/store/
287
http://KnowledgeInbox.com/store/
Pr
ev
i
ew
Bo
ok
292
http://KnowledgeInbox.com/store/
http://KnowledgeInbox.com/store/
16
Pr
ev
i
ew
Bo
ok
There are times when advanced users want the ability to code QTP scripts in a different
scripting language than VBScript. A few such instances include the need for better
exception handling (using Try-Catch-Finally), designing forms for user interaction,
Object-Oriented features, need for Optional Parameters and better support for Win32 APIs
(VBScript's support through the Extern object is very limited) etc. It is not possible to use
any language except VBScript inside QTP, yet it is still possible to create a COM-based
bridge for languages that support COM. We will be demonstrating such a bridge in this
chapter built in C# and Visual Basic using .NET Framework 4.0. Before we see how the
bridge is created, there are few concepts that we need to understand.
http://KnowledgeInbox.com/store/
323
http://KnowledgeInbox.com/store/
Bo
ok
Pr
ev
i
ew
In this code an oXLSheet.Cells object is used to pass a value to an Excel Worksheet. Even
though Excel runs as a separate process in the system, we can still pass values to it. This
is called out-process communication. It works through use of a proxy object in the caller
SURFHVVZKLFKURXWHVWKHFDOOXVLQJ5HPRWH3URFHGXUH&DOO53&DVVKRZQLQWKHJXUH
below:
324
http://KnowledgeInbox.com/store/
http://KnowledgeInbox.com/store/
ok
Pr
ev
i
Web Extensibility
ew
17
Bo
Introduction
The Web Extensibility Add-in coupled with the Extensibility Accelerator for HP Functional
Testing provides a platform that enables Automation Engineers to extend support for
custom web controls and toolkits.
A compelling case to opt for Extensibility is in a situation where some web controls which
are not supported out-of-the-box are recognized as generic WebElements; these generic
objects may implement the behavior of a TextBox, Link, Button or List etc. Since the Web
$GGLQ GRHV QRW UHFRJQL]H WKHLU VSHFLF EHKDYLRU 473 PDSV WKHP WR WKH :HE(OHPHQW
class. Every such generic object thus ends up supporting the functions/methods/events of
the WebElement class.
This is where the web add-in Extensibility plays an important role because a control can
http://KnowledgeInbox.com/store/
339
http://KnowledgeInbox.com/store/
18
ok
Pr
ev
i
ew
Bo
Introduction
A reserved object allows you to add a specialized keyword to QuickTest which unlike custom
classes provides you with IntelliSense. For example, the Environment object is a reserved
object with the ProgId of Mercury.MicEnvironment. Similarly, a Description object
(Description.Create) is another reserved object with ProgId of Mercury.DescObjCreator.
Just like with these reserved objects, it is also possible to create custom reserved objects.
At runtime, QuickTest creates a single instance of the reserved object as required by the
test code. Unlike instances of other objects, such as references to custom classes or classic
COM objects (Scripting.Dictionary or FileSystemObject objects created explicitly during
Test-run, for example), a reserved object is created on demand when referenced during
7HVWUXQ8VDJHDQGFUHDWLRQRI5HVHUYHG2EMHFWVZDVUVWVKRZQLQWKHGRFXPHQWDWLRQ
made available with QTP Plus (QTP 8.2).
http://KnowledgeInbox.com/store/
393
http://KnowledgeInbox.com/store/
Pr
ev
i
ew
Bo
ok
&UHDWHDQHZYDOXHZLWKWKHQDPH8VH%%+RRNDQGVHWWKHYDOXHDV
http://KnowledgeInbox.com/store/
401
http://KnowledgeInbox.com/store/
Pr
ev
i
ew
ok
Introduction
Bo
You have decided what test cases need to be automated. You have selected the right
automated tool for your environment. You have even created automated tests that are
robust and tend to be resistant to changes in the UI. However, how do your tests perform?
Are there unnecessary Wait statements in your code? Are you using techniques that place
more than the required stress on the Automation tool?
8QWLOQRZZHKDYHGHVFULEHGLQGHSWKKRZWRZRUNZLWK2EMHFW,GHQWLFDWLRQLQGLIIHUHQW
scenarios and with different technologies. In this section, we will describe which techniques
result in code that performs faster. Please note that we are not comparing the advantages
and disadvantage of one approach over another. Each approach detailed up until now has
its own pros and cons. This chapter merely compares the performance difference between
WHFKQLTXHVZHURXWLQHO\XVHLQ2EMHFW,GHQWLFDWLRQ
To run our tests and compare difference between different techniques, we are going to use
http://KnowledgeInbox.com/store/
413
http://KnowledgeInbox.com/store/
C
2
ok
Pr
ev
i
ew
Bo
This table summarizes both XPath and CSS Selectors. Both Selectors have been discussed
in detail in Chapters 11 and 12. This appendix compares both side-by-side.
Select By
Element
ID
Class
Attribute
XPath
CSS
//p
//span[@id='user']
span#user
//span[@class='user']
span.user
//span[@name='user']
span[name='user']
http://KnowledgeInbox.com/store/
423
http://KnowledgeInbox.com/store/
D
2
Pr
ev
i
ew
Appendix D - Nesting of
RegisterUserFunc Methods
ok
We have already seen how RegisterUserFunc works in QTP. Now lets see what happens
when RegisterUserFunc is used in a nested fashion. Consider the following code:
Bo
http://KnowledgeInbox.com/store/
427
http://KnowledgeInbox.com/store/
Pr
ev
i
ew
Bo
ok
The Eval function and Execute statement provide the ability to evaluate and execute
dynamic code at runtime. Evals purpose is to evaluate a string and return the evaluation
result. Execute simply interprets a string expression and executes it. An example of Eval
and Execute is shown below:
Execute "Dim x, y : x = 2 : y = 4"
MsgBox Eval("x = y")
As stated earlier, Eval returns the result of the string evaluation whereas Execute will
http://KnowledgeInbox.com/store/
433
http://KnowledgeInbox.com/store/
ok
Pr
ev
i
ew
Bo
http://KnowledgeInbox.com/store/
437
Index
http://KnowledgeInbox.com/store/
Index
Symbols
_JAVA_OPTIONS ....................................................................................................................................... 8
A
Adding objects to SOR.............................................................................................................................. 20
ew
ev
i
Bo
ok
Pr
D
Descriptive Programming ........................................................................................................................ 55
http://KnowledgeInbox.com/store/
445
http://KnowledgeInbox.com/store/
Pr
ev
i
ew
Common Mistakes................................................................................................................................. 79
Enumerating ChildObjects ................................................................................................................... 64
Implicit and Explicit Properties ........................................................................................................... 58
Keyword-based Descriptive Programming Object Repository ....................................................... 93
Converting QTP SOR to Keyword-based DP OR......................................................................... 107
Enhancing the Keyword-based Object Repository......................................................................... 99
Enumeration of Child Objects......................................................................................................... 104
Instantiating a Test Object ................................................................................................................. 96
Storing the Object Repository ........................................................................................................... 98
Test Object Aliases ............................................................................................................................ 103
Using a Hybrid OR (DP plus a Regular OR) ................................................................................. 106
Object Casting ........................................................................................................................................ 88
Object Spy ............................................................................................................................................... 56
Test Object Override ............................................................................................................................. 86
The micclass Identifier .......................................................................................................................... 63
Using a VBScript DP Object Repository ............................................................................................ 72
Using Description Objects .................................................................................................................... 60
Using Description Strings ..................................................................................................................... 63
Using Descriptive Programming in Scripts........................................................................................ 91
When to use Descriptive Programming ............................................................................................. 59
Bo
ok
GetDOMObjectByPath........................................................................................................................... 151
getElementById ....................................................................................................................................... 138
getElementsByName ........................................................................................................................137,153
GetRowWithCellText .............................................................................................................................. 171
H
HTML DOM ............................................................................................................................................ 133
Binding to an Element using HTML DOM ..................................................................................... 142
Checking Appearance using Style Sheets ......................................................................................... 147
Converting a DOM object to a QTP Test Object ............................................................................ 144
446
http://KnowledgeInbox.com/store/
Index
http://KnowledgeInbox.com/store/
ew
ev
i
ok
Pr
IBM_JAVA_OPTIONS ............................................................................................................................... 8
Identification Properties
Assistive Properties................................................................................................................................ 12
Mandatory Properties ........................................................................................................................... 12
Ordinal Identifiers ................................................................................................................................. 12
Installing the Web Extensibility Add-in ............................................................................................... 344
Bo
JAVA_TOOLS_OPTIONS.......................................................................................................................... 8
O
Object Identification Algorithm .............................................................................................................. 13
Object Identification Settings .................................................................................................................. 15
Object References Unusable after Navigation ....................................................................................... 86
Object Repository Parameters (ORP)..................................................................................................... 28
ObjectRepositoryUtil
Converting between TSR file and XML Files ................................................................................... 266
http://KnowledgeInbox.com/store/
447
http://KnowledgeInbox.com/store/
P
Performance Benchmarks ...................................................................................................................... 413
Results ................................................................................................................................................... 420
ew
Q
QTP .NET COM Bridge ......................................................................................................................... 325
ev
i
Pr
RepositoriesCollection.............................................................................................................................. 52
Reserved Objects ..................................................................................................................................... 393
Creating an Icon ................................................................................................................................... 397
How to Create....................................................................................................................................... 394
Bo
ok
448
http://KnowledgeInbox.com/store/
Index
http://KnowledgeInbox.com/store/
Pr
ev
i
ew
ok
Bo
Utility Objects
Extern .................................................................................................................................................... 411
RepositoriesCollection .......................................................................................................................... 52
Repository ............................................................................................................................................... 30
W
Web Extensibility
Cases to opt for..................................................................................................................................... 339
Developing Toolkit Support Set with Extensibility Accelerator .................................................... 349
http://KnowledgeInbox.com/store/
449
http://KnowledgeInbox.com/store/
Bo
ok
Pr
ev
i
ew
Extensibility Accelerator
Adding new Custom Control .......................................................................................................... 352
Creating a New Project ..................................................................................................................... 349
Defining operations .......................................................................................................................... 359
Defining Properties ........................................................................................................................... 364
Deploying the Solution ..................................................................................................................... 368
Deploying Toolkit Support Set on Other Machines ..................................................................... 376
_elem ................................................................................................................................................... 361
General test object settings .............................................................................................................. 350
logical_name property ...................................................................................................................... 367
Mapping the Control ........................................................................................................................ 354
Using the Custom Test Object Class with QTP ............................................................................. 369
_util ..................................................................................................................................................... 364
Installing the Web Extensibility Add-in ........................................................................................... 344
Limitations and Issues ......................................................................................................................... 390
Recording Generic Controls without Extensibility ......................................................................... 347
Test Object Configuration File
ClassInfo element .............................................................................................................................. 383
Description element .......................................................................................................................... 384
IconInfo element ............................................................................................................................... 385
IdentificationProperty element........................................................................................................ 384
Load element...................................................................................................................................... 385
ReturnValueType element ................................................................................................................ 385
TypeInformation element................................................................................................................. 382
The Toolkit Configuration file............................................................................................................ 386
Conditions element ........................................................................................................................... 387
Control element ................................................................................................................................. 387
Filter element ..................................................................................................................................... 388
Identification element ....................................................................................................................... 387
Settings element ................................................................................................................................. 388
Using Functions to Define Filters ...................................................................................................... 389
Using Functions to Get Property Values .......................................................................................... 390
WebTable
Asynchronous Table Loading ............................................................................................................. 177
Clicking inside a WebTable ................................................................................................................ 176
Finding a Row containing Specific Text............................................................................................ 173
Performing Operations on Objects Inside the Table....................................................................... 172
Retrieving the Parent WebTable from an Element .......................................................................... 178
WebTable Identification in QTP ............................................................................................................ 167
450
http://KnowledgeInbox.com/store/
Index
http://KnowledgeInbox.com/store/
Bo
ok
Pr
ev
i
ew
http://KnowledgeInbox.com/store/
451
http://KnowledgeInbox.com/store/
Bo
ok
Pr
ev
i
ew
452
http://KnowledgeInbox.com/store/
http://KnowledgeInbox.com/store/
ev
i
ew
ok
Pr
The story follows the journey of Nurat, who encounters a series of challenging interviews
LQ D VHDUFK IRU KLV GUHDP MRE 7KH TXHVWLRQDQGDQVZHU VW\OH RI WKH ERRN DGGUHVVHV
many of the questions frequently asked by QuickTest practitioners and aims to correct
common mistakes and misunderstandings surrounding QTP by providing clear and concise
explanation of the topics at hand.
Bo
Whether it is to brush up your QTP knowledge and skills or simply to satiate your curiosity
DERXWKRZDVHDVRQHG,7YHWHUDQIDUHGLQDQRKROGVEDUUHGLQWHOOHFWXDOGXHORQ473WKLV
book is sure to leave you astonished with its pace of narration, expertise, and sheer breadth
of topics covered.
,6%1
For more details, please visit www.KnowledgeInbox.com/books/
http://KnowledgeInbox.com/store/
453
http://KnowledgeInbox.com/store/
Pr
ev
i
ew
Bo
ok
QuickTest Professional 2nd Edition includes all features of QTP 11 as well as additional
XSGDWHVWKDWKDYHEHHQLQWURGXFHGRYHUWKH\HDUV:LWKDEUDQGQHZLQGHSWKFKDSWHURQ
Object Repository, this book delivers a clear message: QuickTest is an immensely powerful
automated testing tool. QuickTest Professional 2nd Edition brings to light a plethora
RIKLGGHQDQGKLJKO\LQQRYDWLYHIHDWXUHVDQGLVDPXVWKDYHYROXPHIRUDQ\473XVHUV
bookshelf.
,6%1
454
http://KnowledgeInbox.com/store/
Bo
ok
ie
w
ev
Pr