uft & qtp interview unplugged 2nd ed

38

Upload: tarun-lalwani

Post on 12-Nov-2014

3.205 views

Category:

Documents


21 download

DESCRIPTION

 

TRANSCRIPT

Page 1: UFT & QTP Interview Unplugged 2nd Ed
Page 2: UFT & QTP Interview Unplugged 2nd Ed

UFT/QTP Interview Unplugged

And I thought I knew UFT! - 2nd Edition

By Tarun Lalwani

Page 3: UFT & QTP Interview Unplugged 2nd Ed

UFT/QTP Interview UnpluggedPublisher: KnowledgeInboxTechnical Editor & Reviewer: Anshoo AroraEditor (2nd Edition): Manika GargEditor (1st Edition): Chhanda BurmaanIllustrations by Jophy Joy

ISBN: 978-0-9836759-4-5© 2013 KnowledgeInbox. All rights reserved.Printing History:April 2013: 2nd EditionSeptember 2011: First Edition (ISBN: 978-0-9836759-0-7)Copyright © 2011 Hewlett-Packard Caribe B.V. Reproduced with PermissionNo 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 per-copy fee to KnowledgeInbox. Contact online at KnowledgeInbox.com/contact-us.

Source codes discussed in this book can be copied, modified, or distributed without permission from author/pub-lisher by including the below reference comment header.

'Source code taken from "UFT Interview Unplugged - And I thought I knew UFT!" By Tarun Lalwani

'The link for downloads is KnowledgeInbox.com/demos/UFTInterviewUnplugged_SourceCodes.zip

'Website: KnowledgeInbox.com/books/

This document also contains registered trademarks, trademarks, and service marks that are owned by their respec-tive 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 REPRESEN-TATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF THIS WORK AND SPECIFICALLY DISCLAIM ALL WARRANTIES, INCLUDING WITHOUT LIMITATION WAR-RANTIES 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 PUB-LISHER 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 PRO-VIDE 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.

Page 4: UFT & QTP Interview Unplugged 2nd Ed

Dedication

Eyes are a gift of God to us, to be able to see how beautiful this world is. But there are a few souls out there who are not blessed with this gift. I would like to dedicate this book to those who are visually impaired or blind, and have to work harder for every day-to-day challenge. I promise to donate ` 10/- for every copy sold to institutes helping visually impaired people.

Page 5: UFT & QTP Interview Unplugged 2nd Ed

vLalwani

About the AuthorAbout Tarun Lalwani

Tarun is the founder of Tarun Automation Research & Labs (TARLABS); a company focused on Test Automation Products and Services. He is the author of the three most widely-read books on QTP, ‘QuickTest Professional Unplugged’, ‘And I Thought I knew QTP!’ and ‘QTP Descriptive Programming Unplugged’. He has expertise in Test Automation using various technologies such as VBScript, VB6, VB.Net, C#.NET, Excel, and Outlook Macros. He is also the owner and lead author for KnowledgeInbox;

a blog and publication house focused on Test Automation.

Tarun was awarded with the ‘Best Feedback Award’ by HP for QTP 11 Beta testing and his book ‘QuickTest Professional Unplugged’ was named as the Best Automation Book in the 2nd ATI Automation Honors awards. A regular contributor on AdvancedQTP and SQA forums, Tarun’s work has been showcased on several websites, including www.relevantcodes.com and www.advancedqtp.com.

In Dec 2011, HP invited Tarun to its R&D center in Israel for a 4 day conference. The conference was aimed at taking his feedback on various aspects of QTP & BPT. This was the first time ever HP had invited any user from outside of Israel for feedback. The invitation highlights HP’s 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.

Page 6: UFT & QTP Interview Unplugged 2nd Ed

ForewordELFRIEDE DUSTIN

In recent times, many IT companies have realized that software testing needs to be an integral part of their R&D efforts. Companies on the leading edge of software development, such as Google or Facebook, recognize the need for automated testing approaches. For example, Facebook1 “is safely updated with hundreds of changes including bug fixes, new features, and product improvements. Given hundreds of engineers, thousands of changes every week and hundreds of millions of users worldwide,” Facebook relies on their automated testing program that includes unit and water (GUI) testing as part of their release efforts. Another example, Google2 “uses a product team that produces internal and open source productivity tools that are consumed by all walks of engineers across the company. They build and maintain code analyzers, IDEs, test case management systems, automated testing tools, build systems, source control systems, code review schedulers, bug databases... The idea is to make the tools that make engineers more productive. Tools are a very large part of the strategic goal of prevention over detection.”

The message is clear: quality software can’t be released without an effective automated testing program. Numerous automated testing tools are available to support these efforts and one of the most popular 3rd party automated testing tools is HP’s QuickTest Professional3 : “HP continues to be the dominant player in the market, with a presence in virtually every large enterprise... Its position requires all other players to position around HP’s tools, and is strong enough that several competitors also have integration with HP products. Virtually all SIs, outsourcing providers, and testing consultancies support the HP product line, making it easy for organizations to find experienced testers. SAP now resells HP testing tools as part of its overall quality solution. …HP has grown its breadth in the quality space through acquisition, adding strong offerings for security analysis. New product releases in 2010, and planned for 2011, show that HP has retrenched in technical innovation to extend the breadth of its quality solutions (adding test data management and manual testing) and participate in a wider portion of the ALM market… The company has a broad set of tools for software quality, including: Functional Testing (including UFT),” among many other tools.

A dominant tool such as UFT needs to be accompanied by a “How to..” book. Tarun Lalwani has taken an encouraging lead in providing valuable UFT information to help educate new and experienced UFT users, with his first book ‘QuickTest Professional Unplugged’ and now followed it up with ‘UFT Interview Unplugged!’ With this book, Tarun has come up with a ‘must-read’ guide that can help a user implement successful

Page 7: UFT & QTP Interview Unplugged 2nd Ed

UFT testing programs and efforts. Even though the book is about a dry topic like UFT automation, it is well written and entertaining and in the format of an ‘interview’. It gives a thorough dissection of many possible UFT problems via various UFT questions and answers. This book articulates solutions to most UFT issues a user will run into and provides timely and necessary material for any UFT user – beginner or advanced.

Elfriede DustinAutomated Software Testing Evangelistwww.idtus.com

Elfriede Dustin, an IT veteran with over 20 years of experience behind her, has authored and co-authored various books on Software Testing like ‘Quality Web Systems’, ‘The Art of Software Security Testing’, ‘Automated Software Testing’, ‘Effective Software Testing’ and ‘Implementing Automated Software Testing’. She currently works for ITD.

1 https://www.facebook.com/Engineering#!/video/video.php?v=10100259101684977&oid=9445547199&comments

2 http://googletesting.blogspot.com/2011/01/how-google-tests-software.html

3 http://www.gartner.com/technology/media-products/newsletters/itko/issue1/gartner.html

Page 8: UFT & QTP Interview Unplugged 2nd Ed

ForewordAJ ALHAIT

“And I thought this was going to be just another technical book!”

Tarun’s new book “UFT Interview Unplugged” is a unique revolution in technical book authoring! This was unlike any technical book I’ve ever read. The approach is so interesting, it makes you want to read on like you are reading a sci-fi novel. It’s quite interesting and a fun read, but do not expect to use it as a technical reference manual. This is one book that you can actually learn something from by reading it start-to-finish.

Tarun has, in a way, revolutionized technical book authoring by writing this book… I expect others to ‘get inspired’ and use a similar structure and style in the future. Kudos to Tarun for writing this ‘out of the park’ hit.

AJ Alhait

Founder

SQAForums.com

QAtraining.net

Amjad Alihat (AJ), founder and owner of SQAForums.com and QAtraining.net, has over 18 years of experience in software testing, and has been working as a consultant for over 10 years. Started in 1999, SQAForums.com is a hub for various QA professionals and has around 190,000 members. As a knowledge-sharing platform it has helped many professionals to increase their expertise. Tarun also started his knowledge sharing through SQAForums, later expanding the same by launching his blog KnowledgeInbox.com and now through his books.

Page 9: UFT & QTP Interview Unplugged 2nd Ed

Preface

Page 10: UFT & QTP Interview Unplugged 2nd Ed

xiiiLalwani

Preface

��

While conducting job interviews recently for my company, I found that many candidates failed to answer simple questions on UFT. I could easily gather that some of them had practical experience but bombed at explaining the concepts behind it. Some candidates were obviously exaggerating their level of knowledge or expertise in the given field.

Until a year back, my first instinct on any public forum was to refrain from answering any interview questions, so as not to promote or encourage standardized answers or discourage independent thought. Even if I did answer, I would first check to see what efforts the person had undertaken to look for the answer.

But recently, a mock interview with a teammate started a chain of thought. During the interview, she got nervous and was unable to answer some basic questions, even though her practical knowledge is quite strong. It was then that I realized people may have practical experience or expertise yet still lack conceptual knowledge of UFT.

After this incident, I started looking at various forums only to seek UFT questions being asked and the responses made. The worst part of this exercise was to see so many incorrect answers being offered by novices or inexperienced users. For example, one of the questions, ‘Is it possible to use JavaScript in UFT?’ was answered as, ‘Yes, we can use JavaScript in UFT. But before that, we have to install Java Add-in’. This is only one of the replies among many that may spread misinformation amongst the beginners. There were other users who replied in support of the above answer. Even though I was surprised to find such replies and support, I was, at the same time, a little concerned about incorrect knowledge being shared by users like this.

Today, experts worldwide refrain from answering such queries with the intent of discouraging standardized answers. But my recent experience made me realize that it is even more important for experts to answer these questions correctly to eliminate the ever increasing gap in conceptual knowledge of UFT.

With this goal in mind, I decided to write a book on UFT with a fluid storyline and a dialogue-based approach instead of a plain FAQ style format (as it limits the scope of dialogue) that most technical books seem to follow. The result is a book which hopefully makes learning basic-to-really-complex UFT concepts interesting and entertaining for the reader. It is my hope that I have achieved (at least to some extent) what I had set out to do when I started writing this book; that is eliminate misinformation and doubts in the minds of UFT practitioners.

Page 11: UFT & QTP Interview Unplugged 2nd Ed

xiv

UFT Interview Unplugged

Tarun

Target Audience

Manual Testers, Analysts, and/or Managers who want to switch to Automation or UFT users with any level of expertise should benefit from this book. The book touches on the various concepts of UFT and attempts to provide information that is missing in theoretical and practical domains of UFT. Attempt has been made to explain concepts in a straightforward way without sounding too simplistic.

This book is a must for aspiring candidates who want to make sure they are ready for their next interview. It is also a great resource for interviewers as well.

The book is also recommended for those appearing for QTP/UFT certification.

What’s new in the 2nd Edition?

A lot of our 1st edition readers had requested for an Index, so that they can refer to topics directly in the book. In this edition we have included the same at the end of the book. This will make sure you can now use this book as a reference book as well.

The 2nd Edition has been updated to cover the latest version of QTP also known as UFT 11.5 (Unified Functional Testing).

In this edition of the book we will be referring to UFT only and not QTP. HP QTP is now basically a UFT GUI Script and HP Service Test is a UFT API Script.

This edition has more screenshots and code to support the concepts being spoken about.

Where can you order this book?

Order online at KnowledgeInbox.com/store/

For bulk orders & discounts, please email us at [email protected].

Your Feedback Counts!

We at KnowledgeInbox take every feedback very seriously. Let us know what you think about this book — what you liked or what you didn’t or simply what you would like to read about in a future book. Your feedback will help us in coming out with books that are relevant and in tune with what our readers want.

To send us general feedback, simply send an e-mail to [email protected] and please mention the book title in the subject line of your message. Alternatively you can leave a feedback online at KnowledgeInbox.com/contact-us/

Page 12: UFT & QTP Interview Unplugged 2nd Ed

All characters/names appearing in this work are purely fictitious.

Any resemblance to real person(s)/company/names/material/product is purely coincidental.

Page 13: UFT & QTP Interview Unplugged 2nd Ed

January 2013

Page 14: UFT & QTP Interview Unplugged 2nd Ed

3Lalwani

January 2013

��

M y flight landed at the Pune airport around 11:00 a.m. One thing I always loved about QueenFisher flights was their on-time performance. I was

tired and eager to pick my luggage and rush back home but a technical glitch at belt #2 delayed that by almost half an hour. I had gotten used to long waits by then. After waiting for 40 odd minutes I finally spotted my bag. I picked up the bag and took a pre-paid cab home.

Strangely and unseasonably it was raining heavily and there was a high probability of getting stuck in a traffic jam. Luckily the situation was not as bad as I had expected and I reached home around 1.30 p.m.

I had planned earlier to go to work for the remainder of the day but after the exhausting flight and subsequent waiting, I changed my plan and decided to take the 2nd consecutive day off. I dozed off for a few hours and was in deep sleep when I suddenly woke up with a very strange feeling. I couldn’t remember feeling this anxious and nervous ever before. I started biting my nails for the first time in my life wondering what would happen next. I knew I couldn’t have done anything differently. I tried convincing myself not to think too much about it and somehow passed the day.

The next day was Friday, a day when the office takes on a more cheerful look since we are allowed to dress in casuals. I reached my desk and opened Outlook to check my emails. When I checked my inbox, it felt like I had been away for ages although I had been on leave for just two days. Two Hundred and Twenty Six unread emails! By the time I’d finished reading them all I realized two hundred of them were just forwards or mails that weren’t of any real interest to me. I thought to myself, ‘what a waste of time’ but then suddenly lightning struck me. I realized I was on the bench and would need such things to kill time.

It felt really strange to be on the bench after seven years of working on tight delivery schedules. I won’t say it felt great because I’ve always preferred to work but I knew I wouldn’t mind this break for a few days.

It was time to catch up with my friends and at the lunch table they had only one question, ‘Where were you for the past two days?’ I somehow managed to change the topic, and avoided answering their queries. They knew I was up to

Page 15: UFT & QTP Interview Unplugged 2nd Ed

4

UFT Interview Unplugged

Tarun

something but they had no idea what.

I spent the rest of the day reading some articles I had saved on my desktop. Some articles were so engrossing that hours passed by before I realized it was almost time to go home.

Upon reaching home I decided to watch my favorite movie on DVD — ‘The Matrix’. I just loved the concept of the movie. The most interesting question the movie raised was regarding our interpretation of reality.

I was already halfway through the movie but at my back of my mind all the events from the past week were being replayed. There was this one thing that I knew might change the whole game and I was afraid that I might have gotten it all wrong. But I knew there was nothing I could do now since it was a thing of the past. If it was just one person’s decision then I knew it would have been in my favor but there were many people involved in this.

Page 16: UFT & QTP Interview Unplugged 2nd Ed

5Lalwani

January 2013

My roommate had left for his home town and was away for two weeks. I knew it would be tough to get through the weekend on my own, so I decided to call up few of my friends and go for a movie. All of us met at FSquare and enquired about the current shows. To our disappointment all the movie shows were running full. I wondered if everyone in the city had decided to watch a movie on that day.

Suddenly we noticed a guy giving away free tickets for the ‘Feel N Freaky’ movie. I knew the movie was pathetic but then we had no other options as well. We asked the guy about the offer and he told us that if we had a KodaFone cell connection we could get two tickets free. Three of us had that cellular service provider and I thought it was our lucky day. Alas, that was not to be. He just had the last two free tickets to offer. Since we had no use for just two tickets, we decided to try our luck at another movie theatre nearby.

My friend asked me, ‘What about these tickets?’ to which I replied, ‘Nothing, let’s just throw them away.’

While crossing the road on the way to the car parking, I saw two girls approaching from the other side. On seeing them, I got an idea. I walked up to them and said:

Me: Hey, do you want to watch ‘Feel N Freaky?’

(She looked at me with unsure eyes wondering if it was she I was talking to or someone behind her.)

Girl: Yes, but...

Me: Okay, I have two tickets for the movie if you want. And without even waiting for her reply I handed her the two tickets.

Girl: How much?

Me: It’s free. Enjoy the movie.

Girl: No, I would like to pay.

And she took out some money.

Me: Don’t worry, it’s free; I can’t watch it.

(I knew that after watching the movie she would be cursing me. :D)

Page 17: UFT & QTP Interview Unplugged 2nd Ed

6

UFT Interview Unplugged

Tarun

I crossed the road and my friend had already brought the car outside the parking lot. We went to another theatre and this one had tickets available. We knew we could watch the movie of our choice and we all agreed to watch ‘Inception’. The show was scheduled to start at 6:30 p.m. and it was 5:15 p.m. then. So we decided to head over to FarBucks coffee shop and chitchat over a hot cuppa. Relaxed, sipping my vanilla latte, the events of the preceding days came back to my mind again. But suddenly Raju interrupted me and I snapped back to the present.

The movie started at 6:30. To say I was awed would be an understatement. I had never seen any movie in my life that had a concept as great as this one. Stepping into someone’s dream and stealing thoughts. I really admired the storywriter’s imagination and grasp on the topic of dreams. It was just truly incredible and made me realize how little we know about what goes on inside our brain when we sleep. But honestly, I too was not interested in knowing about it; I prefer deep sleep where I am unaware of what is happening.

Page 18: UFT & QTP Interview Unplugged 2nd Ed

7Lalwani

January 2013

After the movie was over, we went for dinner to Inland China. It was my first visit to this restaurant and I was having Chinese cuisine after a long time. I thoroughly enjoyed the food and felt happy.

I woke up around noon on Sunday and had a lazy brunch. After reading the papers, I got busy with cleaning up the house.

Monday arrived and I started the day with high hopes. I was waiting for that one email. Since my ‘WhyMail’ account was blocked in the company, I had set a forwarder to my office email id. The whole day, the only thing I did was to hit the f9 button on my keyboard and scan every new email. But the one I was waiting for never came. This continued for the next three days and I had the sinking feeling that I had lost it. I felt very disappointed and dejected too, but I knew this was not the end of the world. I recollected the statement I had quoted to Andrew.

‘Success or failure is a part and parcel of life. You learn from failures and move on to new challenges with even stronger determination.’

Days passed and it was Friday again. I had settled back into my normal routine. It was around 11:00 a.m. when I got a call from a Delhi number. My eyes lit up as I wondered if this was the call I had been waiting for.

Me: Hello.

Caller: Hello Sir, I am calling from ISEEI bank. Would you like to apply for a home loan?

Me: (I nearly lost it! It felt like destiny was playing games with me. I wanted to disconnect the call immediately but I knew she was just doing her job.)

Yes madam, are you giving any free Home also along with that loan?

Caller: No sir, we can just give the home loan.

Me: But what will I do with the home loan without a home to apply it for?

Caller: Sir, that you will have to find on your own or else we can send our consultants to assist you.

Me: Hmm, ok how much loan can I get?

Page 19: UFT & QTP Interview Unplugged 2nd Ed

8

UFT Interview Unplugged

Tarun

Caller: Sir, can you please tell me where you work and what is your monthly income?

Me: I have a small tea shop in CannotPlace, Delhi and it does well but I can’t disclose my income.

(By now she knew what I was doing and hung up.)

After the call ended, I went back to reviewing all the events of the past few weeks and replaying in my mind the sequence of events that had started on a regular Monday two weeks ago.

Page 20: UFT & QTP Interview Unplugged 2nd Ed

The Consultant Call

Page 21: UFT & QTP Interview Unplugged 2nd Ed

19Lalwani

The Consultant Call

��

Me: Hello.

Caller: Am I talking to Mr Nurat?

Me. Yes, speaking.

Caller: Hi Nurat, I am Megha from No Pay Consultancy.

Me: Ok?

Megha: I found your profile on BeastJobs.com and one of our esteemed clients has some requirements in Test Automation.

Me: Ok, what type of role is it?

Page 22: UFT & QTP Interview Unplugged 2nd Ed

20

UFT Interview Unplugged

Tarun

Megha: Our client is developing a framework on UFT and is looking for people with expertise in framework design and development.

Me: Sounds good. May I please know who the client is?

Megha: It is MecroHard. They have offices in US and India, but this opportunity is for their offshore centre.

Me: This role seems interesting to me.

(I just couldn’t believe I had a possible opportunity in a company everyone dreams to be a part of.)

Megha: So can I arrange a telephonic interview for you?

Me: Yes, fine. But when would it be?

Megha: Their requirement is a bit urgent, so the telephonic interview will happen today itself. Would 8 p.m. today be fine with you?

(I thought I would leave on time today. Since I was on the bench from today it shouldn’t be an issue).

Me: Fine. But what kind of interview would it be?

Megha: It will be a technical interview and for now they will only check the basic UFT concepts. So just to confirm, I am scheduling your telephonic interview for tonight at 8 o’clock.

Me: Yep, it’s fine.

It was 11:30 a.m., so I thought of catching up with a few friends for lunch and leaving office early by around 5 o’clock. I wasn’t really worried about the interview since the consultant had said it would be UFT basic interview and I have been working on UFT since a long time. Yet still, a part of my conscience gave me a worried pinch at that particular time interval as if someone had set a clock inside my head.

I called Raju for lunch along with Kulu and Uma. We met in the cafeteria and grabbed a table somewhere in the middle this time. We were having lunch together after a long time but my project was topic of discussion here too. Except for Raju and me, the others were in manual testing. Hence it was

Page 23: UFT & QTP Interview Unplugged 2nd Ed

175Lalwani

Face to Face Interview Round 2

Alex: When we declare a class in an associated library, why do we get an error using the New operator for that class in an Action?

Me: Every Action runs in its own namespace which is different from the namespace where the associated Libraries run. New operator in VBScript can only work with local classes that have the same scope as the statement where the New operator is used. The reason behind this behavior is that, by default, Classes in VBScript have a Private scope. So, the only workaround to create a reference to an object having a different scope is byreferencing a Public object within the same scope as the class and then return the same from the Function. Below code shows a sample library Function to do the same:

Class myClass

End Class

Function NewMyClass()

Set NewMyClass = New myClass

End Function

Now in the Action we can get the object using the Function we just declared:

Set oClass = NewMyClass

Alex: What is QFL?

Me: It is an acronym for QuickTest Function Library.

Alex: I have an application where there are two instances of the same application hosted on two different URLs. I want to write a test to compare both the websites. They have the same titles, same objects and everything. How would I work these multiple browsers and do the comparison?

Me: There are a few ways I can do this:

• We can launch two browsers at the same time; identify one of them using CreationTime:=0 for the first open browser and CreationTime:=1 for the second open browser.

• Another way is to launch them with the application URL itself and then identify them using the OpenURL property. Since we know both applications have different URLs this would be a better approach to use.

Page 24: UFT & QTP Interview Unplugged 2nd Ed

293Lalwani

Index

Index

Page 25: UFT & QTP Interview Unplugged 2nd Ed

295Lalwani

Index

IndexAActions 84

Delete an Action call 86Load an Action at Run-time 85Re-usable and Non-reusable Actions 38Types of Actions 38

ADODB.Connection 209Assistive properties 30Associating Libraries to a Test 259Automate a user registration page which has Captcha images 179Automation Object Model (AOM) 124

BBPT (Business Process Testing) 148

Advantages 148Difference from a normal Test 148Disadvantages 148

ByRef 89ByVal 89

CCan I run UFT on both my local and virtual machine using one license? 36Captcha 179Check if an Environment variable exists or not 189Check if a Test was aborted by User 215Check if the Test has passed or failed 91Checkpoints 181ChildObjects 103, 104, 220, 221Close all open browsers 103CloseProcessByName 104Close the last browser that was opened 220COM 111, 125Compare two images in UFT 182Compile VBScript code in QTP 40Connect to databases in UFT 209Continue statement in a loop 89CopyFile 228

Page 26: UFT & QTP Interview Unplugged 2nd Ed

296

UFT Interview Unplugged

Tarun

Count the number of links on a web page using DOM 227CreateObject 110, 111, 112CreationTime 39Cross platform testing 99Crypt 98CStr 165

DData Driven 132DataTable 38, 39, 93, 95, 125, 126, 127, 183, 184, 185, 190, 208, 209, 213, 235

Difference between a design time and run-time DataTable 39Import 93, 235ImportSheet 93Multiple Local DataTable sheets 38

Data types supported by UFT 31DCOM 112Default Add-ins in UFT 85Define a constant at run-time 193Define an object constant 194Delete a row from DataTable 126Description.Create 100, 101, 103, 104, 174, 220, 221, 233Descriptive Programming 94, 99

String based and Object based 100Descriptive Programming based Object Repository 192Descriptive Programming versus Object Repository 193Dictionary 205, 206Difference between a Function and a Sub-routine 87Difference between ‘Browser.Sync’ and ‘Page.Sync’ 109Difference between Checkpoints and Output Value 184Difference between CreateObject and GetObject 110Difference between ExecuteFile and LoadFunctionLibrary 259Difference between GetElementById and GetElementsByTagName 222Difference between internal and external Environment variables 189Difference between Object Repository and Object Repository Manager 32Difference between Run-time object properties and Test Object properties 105Difference between Test Parameters and Action Parameters 241Difference between Window and Dialog Test Objects 184Differences between Functions and Actions 84Different methods to simulate keyboard events in UFT 252Disable Keyword View in UFT 150Disable ‘On Error Resume Next’ statement 117DisableReplayUsingAlgorithm 212Disable Smart Identification during run-time 211

Page 27: UFT & QTP Interview Unplugged 2nd Ed

297Lalwani

Index

DOS 124, 125DotNetFactory 206Driver script 147

EEncrypt 98Environment 188, 189, 262Environment variables 188Error handling methods in UFT 115Excel.Application 110Execute a DOS command 124Execute a UNIX command 125ExecuteGlobal 171Export Environment variables to XML 189

FFetching count of open browsers 103Find an Image with alt property as “continue” 224Find data in DataTable 126Find how many occurrences the sub-string has in the main string 195Fire the Recovery Scenario but not on error 123Flex Add-in 63Framework 132Functions 84, 87

Return multiple values from a Function 87Two ways of passing parameters to Functions 89

GGetElementById 222GetElementsByTagName 222GetLocale 165Get logical name of an object present in Object repository 197GetObject 110GetRef 265, 266, 291GetROProperty 101, 183, 199, 202, 233, 234GetROProperty and GetTOProperty 34GetROProperty(“attribute/<name>”) 202GetRowWithCellText 221, 222GetRowWithRowText 225GetTestObjectName 262Get the name of the Function executing currently 197Get the title of the topmost window 220

Page 28: UFT & QTP Interview Unplugged 2nd Ed

298

UFT Interview Unplugged

Tarun

GetTOProperty 34, 101Global DataTable 39Goto statement 201

HHide Keyword view 86Hierarchy difference between Object Spy and Object Repository 34How are recovery scenarios different from ‘On Error Resume Next’ then? 122How does CreateObject internally work? 112How does UFT identify an object while recording? 30How does UFT internally identify an object? 203How to override a VBScript Function in UFT 264Hybrid frameworks 132, 134

IIdentify the color of a WebElement 218Import 93ImportSheet 93InStr 195InternetExplorer.Application 110IsArray 31items count 39

JJoin 195, 275

KKeyword Driven framework 132, 134, 149Keyword view 150

LLen 195Licensing models of QTP 35Limitations of QTP 155Limitations of Recovery scenarios 124LoadFromFile 189, 190LoadFunctionLibrary 259, 260Local OR 95, 191

MMaximize 260

Page 29: UFT & QTP Interview Unplugged 2nd Ed

299Lalwani

Index

Maximize a Browser 260Maximum size of an array that can be declared 187Measure time taken by a certain operation 150MercuryTimers 150micclass 99Missing Resources pane 176

NNative object properties 105

OObject doesn’t get added to Object Repository 34Object Repository 94, 95, 190, 191

Challenges faced when we use a Shared OR 191Convert Local OR to Shared OR 191Difference between Local OR and Shared OR 191Types of Object Repositories 190

Object Repository parameter 95Object Spy 104ondblclick 235On Error Goto 0 117, 118, 119, 120, 123, 189On Error Resume Next 92, 116, 117, 118, 119, 120, 122, 123, 124, 139, 189, 190, 197Open a link in a new window? 263OpenTextFile 120, 228, 229, 230OpenURL 175Optional parameters 196Option Explicit 40, 168, 169, 170, 204Ordinal identifier 30

PParameters 89Passing Parameters to a Test 241PathFinder.Locate 252PDF 39, 212, 262, 263Possible reasons making the script perform slow 107PostMessage 256PowerDebug 73Print name of all the subfolders in a folder 229

QQFL 175Qt Add-in 63

Page 30: UFT & QTP Interview Unplugged 2nd Ed

300

UFT Interview Unplugged

Tarun

QuickTest.Application 127, 132, 212, 258

RRead a file line by line into an array 229Recovery.Activate 123, 178, 179Recovery Scenario 121, 122, 123, 124, 251, 252ReDim 169, 170, 219, 229RegisterUserFunc 92, 206, 207, 226, 227Remote Desktop 258ReplayType 188, 253, 254, 255, 264, 287Reporter 90ReportEvent 90, 92, 93, 119, 120, 185, 186, 214, 216, 247, 248, 249ReportPath 90RightClick 234Running test on a remote machine 131Run scripts on a locked machine 255RunStatus 90Run-time DataTable 39Run UFT scripts without installing UFT 31

SSchedule a Test run at a specific time 127Scope of a variable in an Action 32Scripting.Dictionary 87, 88, 113, 141, 174, 205, 206, 219, 247, 248Scripting.FileSystemObject 120, 142, 228, 229, 230, 231, 232Select values based on Pattern in a WebList 226SetLocale 165SetROProperty 35SetSecure 99SetTOProperty 35, 105, 249, 250, 251Shared Object Repository 191, 192, 193Siebel 84, 203, 212, 213, 214Siebel Test Express 212Simulate a keyboard typing on to a WebEdit 188Smart Identification 210, 211, 212Stubs 147Sub-routine 87Sync 106synchronization 108SystemUtil.Run 111, 125, 164, 165, 232, 233

T

Page 31: UFT & QTP Interview Unplugged 2nd Ed

301Lalwani

Index

TypeName 31Types of Framework 132Types of Recording 37

UUBound 196UNIX 99, 125Use a variable from one Action to another 264Using custom DLLs in QTP 157

VVarType 31vbArray 31Virtual Objects 256

WWhat’s new in UFT 11.5 60

Call Stack window 70Class IntelliSense 63Environment object IntelliSense 66File content checkpoint 75Functions pane 69Goto dialog 68Insight image based object identification 77Integrated print window 75MSAA API 73Solution 70Upgraded Bitmap Checkpoint 83WebServices add-in 74

Which method is better to use, CreateObject or ‘SystemUtil.Run’? 111WScript.Shell 252

Page 32: UFT & QTP Interview Unplugged 2nd Ed

303Lalwani

Acknowledgements

I would especially like to thank my family for this book. I took a 3-month sabbatical from my work to complete this book and my family extended every support to create a conductive environment and kept all distractions at bay.

I would also like to thank Anshoo Arora (Founder of RelevantCodes.com) who has kindly extended his support as a Technical Editor and Reviewer of this book; Chhanda Burmaan who has contributed as an editor and ironed out the inconsistencies and fine-tuned the narration; Jophy Joy who made the book more interesting and lively with his humorous illustrations, and Manika Garg who has done a fabulous job in editing the 2nd edition of this book.

Anshoo Arora

Anshoo Arora is the founder of RelevantCodes.com — a blog targeted at HP’s QuickTest Professional. He is also co-author of ‘QTP Descriptive Programming Unplugged’, a book focused on Objects in QTP. He is continuously researching to find better ways of working with UFT, simplifying automation maintenance, and creating flexible test suites and frameworks. Apart from UFT, Anshoo also specializes in Quality Center, LoadRunner, .NET (C#, VB.NET), and Web technologies (HTML, CSS, JavaScript, and PHP). Anshoo can be contacted at: RelevantCodes.com/contact.

Page 33: UFT & QTP Interview Unplugged 2nd Ed

304

UFT Interview Unplugged

Tarun

Chhanda Burmaan

After 10 years of experience in different functional areas across various domains like Publishing Outsourcing, Ebook Production, Banking, Telecom and IT, Chhanda is currently on a sabbatical to enjoy a more relaxed pace of life. In between vacations, she undertakes assignments that interest her and range from editing to sub-titling, scriptwriting and translation. She can be reached at [email protected].

Jophy Joy

Jophy works as a UI (User Interface) designer and consultant. He has a great sense of humour matched with good capabilities to present them in visual form. Jophy has worked on the illustrations in this book and tried to capture the essence of the story at various junctures. He can be reached at [email protected].

Manika Garg

Manika Garg is an International English Language Editor. She has been proofreading, editing, reviewing, critiquing, and training for over a decade. She can be contacted at [email protected].

Page 34: UFT & QTP Interview Unplugged 2nd Ed

305Lalwani

Tarun Automation Research & Labs Pvt. Ltd.

Tarun Automation Research & Labs Pvt. Ltd. is a company focused on improving tools, techniques, processes, and knowledge in the field of Test Automation. We currently offer services in the areas mentioned below:

Test Automation framework design and implementation, using any of these tools:

• Selenium

• QTP, BPT, and QC

• UFT GUI & API Testing

• WaitN

• QC/ALM API Automation

Training

We offer trainings on Test Automation and Performances tools, like:

• QTP, Service Test, and UFT

• BPT

• Load Runner

• JMeter

Publishing

We offer publishing services too, currently limited to technical books. We welcome first-time & experienced authors, who have a passion to share their knowledge with the community. We offer higher royalties as compared to the standard mar-ket, as we appreciate and value an author’s efforts.

For further details, please contact us through www.tarlabs.com or email us at [email protected].

Page 35: UFT & QTP Interview Unplugged 2nd Ed

307Lalwani

Our Books

Our Books

Page 36: UFT & QTP Interview Unplugged 2nd Ed

309Lalwani

Our Books

QuickTest Professional Unplugged

‘QuickTest Professional Unplugged’, the first book released by Tarun Lalwani, has received much recognition for being the most detailed and creative book on QTP. It was awarded the Best Automation Book in the 2nd ATI Automation Honors.

Even though this book contains a plethora of information to help QTP starters come up to speed, there are also many never-seen-before topics and techniques that will give advanced users an edge. This mix makes it the recommended option for those aspiring to be not only advanced users, but experts. Containing previously untouched and undocumented features which are not offered in standard QuickTest documentation, ‘QuickTest Professional Unplugged’ has served as the key desktop reference for QuickTest issues for over three years and continues to set an unrivaled example.

‘QuickTest Professional 2nd Edition’ includes all features of QTP 11 as well as additional updates that have been introduced over the years. With a brand new, in-depth chapter on 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 of hidden and highly innovative features and is a must-have volume for any QTP user’s bookshelf.

ISBN: 978-0-9836759-1-4

For more details, please visit www.KnowledgeInbox.com/books/

Page 37: UFT & QTP Interview Unplugged 2nd Ed

311Lalwani

Our Books

QTP Descriptive Programming Unplugged

QTP Descriptive Programming Unplugged is an in-depth reference and guide on using HP QTP Test Objects. A must-have for every user, from beginner to expert, this comprehensive book will help you to master a range of Object Identification techniques in QTP. Written by two seasoned QTP experts – Anshoo Arora and Tarun Lalwani – the book discusses and demonstrates both basic and advanced topics and is presented in a clear and easy-to-follow format. With this book, you will learn about:

• Object Identification• Object Repository (Shared and Local)• Descriptive Programming• Visual Relation Identifiers• ChildObjects• HTML DOM• Internationalization Testing• CSS- and XPATH-based Identification• Web Services• Writing QTP Scripting in .NET• Web Extensibility and much more…

ISBN: 978-0-9836759-2-1

For more details, please visit www.KnowledgeInbox.com/books/

Page 38: UFT & QTP Interview Unplugged 2nd Ed