You are on page 1of 57

A Summer Training Project Report on TEST AUTOMATION USING QTP

In Partial Fulfillment of Bachelor of Technology on Computer Science and Engineering Submitted To, Mr. Pankaj Garg HOD, CSE/IT MIT, Modinagar Submitted By, Jatin CSE 0838010011

Department of Computer Science and Engineering Modinagar Institute of Technology 3rd Milestone, Niwari Road, Modinagar Session 2010-2011

ACKNOWLEDGEMENT
I t i s wi t h g r e a t e s t p l e a s u r e a n d p r i d e t h a t I p r e s e n t t h i s r e p o r t b e f o r e yo u . Th e ma k i n g o f t h i s r e p o r t d o e s n o t i n v o l v e e f f o r t o f a s i n g l e p e r s o n . I t i s p o s s i b l e o nl y b e c a u s e o f c o o p e r a t i o n a n d c o n t r i b u t i o n o f ma n y mi n d s . S e v e r a l e mi n e n t p e o p l e o f CR O MA C A M P US , No i d a S t a t e : UT T A R P R AD E S H h a s ma d e v a l u a b l e contribution to this report through their input. I am thankful to e a c h o f t h e m. I a m e x t r e me l y t h a n k f u l t o Mr . Pa w a n Di x i t ( Q T P T r a i n e r ) a n d M r . S a u r a b h S i n g h ( H R Ma n a ge r ) f o r g i v i n g m e o p p o r t u n i t y t o u n d e r g o t r a i n i n g i n C R OM A C AM P U S , No i d a . I wo u l d l i k e t o p l a c e mys e l f a t t h e f e e t o f G o d Al mi g h t y f o r h i s everlasting love and for the blessings and courage that he gave me , wh i c h ma d e i t p o s s i b l e f o r m e t o s e e t h r o u g h t h e t u r b u l e n c e a n d t o s e t me i n t h e r i g h t p a t h . I wo u l d a l s o l ik e t o t h a n k my f a mi l y, f r i e n d s a n d my c o l l e g e f a c u l t y e s p e c i a l l y Mr . Pa n ka j G a r g ( H O D, CS E / I T ) f o r b e i n g a c o n t i n u o u s s t r e a m o f s u p p o r t a n d c r i t i c i s m, a n d b e i n g a s t a n d w h e n e v e r I n e e d e d . -Jatin

PREFACE

A l l o r g a n i z a t i o n f a c e s t h e c h a n g e i n t h e i r e n v i r o n me n t wi t h r e s u l t a n t c h a n g e i n t h e i r ma r k e t s a n d t h e a b i l i t y t o s a t i s f y t h e i r ma r k e t s . E a c h o r g a n i z a t i o n i s f a c e d wi t h n e w ma r k e t i n g p r o b l e m a n d o p p o r t u n i t i es i n t h e i r e x i s t i n g a n d p o t e n t i a l ma r k e t . A s B i l l Ga t e s o n c e s a i d , i t i s b e t t e r t o c r e a t e e mp l o yme n t t h a n t o b e a n e mp l o ye e . T a k i n g t h i s a s a mi s s i o n t he c o mp a n y wa s s t a r t e d b y a t r i o, t o p r o v i d e e x c e l l e n t t r a i n i n g t o t h e f r e s h e r s w h i c h g u a r a n t e e s a b e t t e r p l a c e me n t i n t h e T e s t i n g f i e l d . A success depends on ma n y factors like their strategies,

t e c h n o l o g y a n d t h e e n t i r e ma n a g e me n t . B u t mo s t i mp o r t a n t a s s e t s o f a n o r g a n i z a t i o n a r e h u ma n wh o a r e e mp l o ye d t h e r e .

TABLE OF CONTENTS
S. No. List of Figures List of Tables 1. Industry Profile 1.1. About Croma 1.2. Salient features 1.3. Courses offered 1.4. Project based Industrial Training 1.5. Client speaks Automation Fundamental Concepts 2.1. Before the emergence of software automation tools 2.2. After the emergence of software automation tools 2.3. Test automation 2.4. Benefits of automation 2.5. Consideration in automation planning and area of Application 2.6. Test automation life cycle methodology Functional Automation Test Framework 3.1. Objective 3.2. Scope 3.3. Functional Description 3.4. Automation Framework Testing Process 3.5. Test Framework Architecture 3.6. Automation Test Life Cycle 3.7. Language Used 3.8. Tool to be Used 3.9. Supported Environments 3.10. System Requirement Title Page No. iv v 1-3 1 1 2 2 3 4-8 4 4 5 6 7 8 9-13 9 9 9 10 10 12 12 12 13 13

2.

3.

4.

Quick Test Professional Overview 4.1. Overview of Test Automation 4.2. Automation Basics 4.3. Scripts Basics 4.4. Parameterization 4.5. QTP Checkpoint 4.6. QTP Actions 5. Overview of Test Automation 5.1. Introduction to Quick Test Professional 5.2. Main stages of Automation 5.3. Quick Test Window 5.4. Best practices to implement Automation Automation Basics 6.1. Objects 6.2. Keyword View 6.3. Recording Modes 6.4. Running Modes 6.5. Introduction to Web Objects Script basics 7.1. Data types 7.2. Variant subtypes 7.3. Variables 7.4. Constants 7.5. Operators 7.6. Conditional Constructs 7.7. Arrays 7.8. Procedures Parameterization 8.1. Data table 8.2. Environment Variables QTP Checkpoint 9.1. Checkpoint 9.2. Standard checkpoint
ii

14-15 14 14 14 15 15 15 16-24 16 21 22 24 25-30 25 25 26 27 29 31-37 31 31 32 33 34 35 36 37 38-39 38 40 41-43 41 43

6.

7.

8.

9.

10.

QTP Actions 10.1. Actions and its types 10.2. Inserting new Actions 10.3. Nesting Actions Training experience List of Abbreviations References

44-46 44 44 46 47 48 49

11. 12. 13.

iii

LIST OF FIGURES

S.No. 1. 2. 3. 4. 5. 6.. 7. 8 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25.

Name Functional test automation life cycle methodology Test Framework Architecture Automation Test Life Cycle System Requirements of QTP Add-in Manager Start up Screen that appears while launching QTP Start up Screen that appears while launching QTP Update Notifier Mercury Tours website homepage Main Window of QTP Standard Toolbar View Toolbar Tools Toolbar Automation Toolbar Insert Toolbar Edit Toolbar Debug Toolbar Action Toolbar Keyword View The alongside figure shows the Record and Run Setting Window Parameterization of test object description Built-in parameterization User-defined parameterization Action Properties Window Insert call to new Action

Page No. 8 11 12 17 18 19 19 19 20 22 22 22 22 23 23 23 23 23 26 27 38 39 40 44 44

iv

LIST OF TABLES

S.No. 1. 2. 3. 4. 5. 6.. 7.

Name Important Testing definitions Different HP Testing Tools Variant subtypes Arithmetic Operators Comparison Operators Logical Operators Different Checkpoints

Page No. 5 6 31-32 34 35 35 40-41

Chapter 1 Industry Profile


1.1. About Croma Campus

Our mission is to be a bridge between the industry and the upcoming professionals. We are a fast growing IT Training Company with extremely talented people with whom you would love to work with. Join Croma Campus to become the part of innovative edge. We're here to help you learn faster using your professional learning style; diagnose and solve any problem you or has. Learning styles determine how you think, how you communicate and even how well you remember things. Get introduced with the best courses in the industry. Our courses are designed by highly technical Automation Testing Professionals to cater the needs of dynamic Software Testing Market. We also offer professional real time projects for students in their final semester. Course completion and project completion certificates will also be provided upon successful completion of the course. We have partnered with major multinational companies to place fresher with our clients.

1.2. Salient Features


Courses endorsed by IT Professionals expert in various technologies. Free Demo classes on every weekend. Flexible timing during weekdays & weekends. Training using real web examples. Training with real life Automation problems and their solutions. Problem resolution 24*7 just on a call. Interview preparation. Real time projects for students in their final semester. Certificates upon successful completion of the course & Project. No extra training required for HP Tool Certification (All included in the course).

Page | 1

1.3. Courses Offered


1. 2. 3. 4. 5.

6. 7.

8. 9.

FDP (Fresher's Development Program) CDP (Career Development Program) TAP (Test Automation Program) SQT (as per CMMI level) QuickTest Professional QTP Basic QTP Advance QTP Expert BPT (Business Process Testing) BPT Basic BPT Advance Quality Center QC Basic QC Advance QC Admin Load Runner LR Basic LR Advance Quality Six Sigma ISO Agile Methodology

1.4. Project Based Industrial Training As per the industry requirement we provide Project Based Industrial
summer Training for BCA, MCA, B.Tech., M.Tech., B.Sc. (IT), M.Sc. (IT) & PGDCA on SQT / HP Mercury Tools/ IBM Family. Upon successful completion: Student is specialized on Manual & Automation Testing. Able to meet the current technical industry standards. Get familiar with real industry environment. Able to stand ahead of competition. Get certificated on course & project.
Page | 2

1.5. Clients Speaks


"Croma Campus is great! Your people are doing an amazing job. I like the way you are training the professionals and I am very happy about the support provided by you after the training. "
Mukesh Pathak NCR Corp., Gurgoan

"I would like to commend on the hard work from the entire team of Croma Campus for coming out with such brilliant way of training the professionals. This also showed the professionalism of handling the targeted, which may be referred over many years from now."
Asheesh Tiwari IBM, Noida

"I feel that this consulting service is of high value to IT Professionals and the enthusiasm & professional attitude of Croma Campus is really appreciated by us. I like to write you to complement Croma and want to continue to engage their services in the next process improvement plan. I am intending to extend our cooperation to many future business plans. I believe Croma's support will be extremely important to our success. Thank you very much for your support."
Rakesh Tomar Headstrong

Page | 3

Chapter 2 Automation Fundamental Concepts


2.1. Before the Emergence of Software Test Automation Tool

Over the past years, the lives of programmers have become easier as they get more tools and solutions that help them quickly develop applications with graphical user interfaces, which improve programmers productivity as a result of this; pressure on the testers has increased. Testers are asked to test more and more code/functionality in very less time. Test Automation, is one of the ways to do this. Soon after the development of new features in a software take place, the new features have to be tested first. If they work fine, even the existing features/functionality related to new features, are to be tested. The test of already existing features is known as Regression Testing. The sole purpose of Regression Testing is to ensure that the new code has not affected the already existing functionality. When this regression testing has to be done manually time and again for every/most of the releases/builds/versions of the software, it is very time consuming. 2.2. After the emergence of Software Test Automation Tools But, nowadays, there are tools available that helps the testers in the test automation by reducing the test time as well as the cost by increasing the test coverage with respect to time. Over a period of years, Test Automation emerged as a very important phase in software development life cycle. In fact, nowadays, Test Automation itself is considered as a separate development cycle. It has got its own process and methodology. There are many Test Automation tools which provide record and playback features that allow users to record interactively user actions and replay it for any number of times, comparing actual results to those expected. Of course, the concept of just Record-and-Playback doesnt comprehend Software Test Automation. Most of the times in Real-Times, you need to do coding for accomplishing several tasks.
Page | 4

Since the core concept behind QTP is functional testing therefore we will not go into details with automation and testing, therefore I have mentioned some important definitions below: Functional Testing Functional Testing is used to verify the functionality if your Application Under Test (or, AUT). For example, Checking whether the Send Mail functionality works fine in a mail application, is an example of functional testing. The Functional Testing done by testers is also called as Black Box Testing. You can test the functionality if an application either using Manual Testing or Automated Testing. Retesting Re-execution of tests on the same application build with different input values or multiple sets of input data is called Re-Testing. Regression Testing Re-execution of tests on modified form of the build in order to ensure that existing functionality still works fine. 2.3. Test Automation

To define Test Automation in simple terms, we can say it is the process of automating the steps of manual test cases and process using an automation tool or utility. The main purpose of test automation is to shorten the testing life cycle and increase the test coverage, with test coverage, with respect to time. Automation can be done using any of the followings: i. Programming languages like C, C++, Java, etc. ii. Scripting languages like JavaScript, Perl Script, etc. iii. Automation Tools like WinRunner, QTP, etc. Though there are several types of test automation tools, we will concentrate only on QTP A HPs powerful Functional Test Automation Tool. The followings are some of the important Test Automation Tools:

Page | 5

HP Provides several types of Automation Tools like QuickTest Professional, Quality Centre, LoadRunner, etc. QuickTest Professional (QTP) is a Functional Test Automation Tool. QTP is widely used for the automation of regression test suite. It is used to test the functionalities of the application by automating the manual action or operations of the user. Quality Center (QR) is a Test Management Tool, which is used to manage the entire Testing Process starting from managing the Releases and Requirements and then Test Planning and Execution and even logging and tracking the defects. All these are the possible with the help of components in QC like Releases, Requirement, Test Lab and Defects. Load Runner (LR) is a Performance Test Automation Tool. LR is used to test the performance of the application under certain load. When your AUT (Automation Under Test) undergoes regression testing several times, there is always a possibility that some of the steps might be missed out skipped out when done manually, which can be avoided in Automation. With the help of automation, you can avoid human errors that you generally commit in manual testing, expedite the testing process and hence save a lot of time and effort which ultimately results in the reduction of Test Life Cycle. 2.4. Benefits of Automation

Save time during test execution. The execution of an automatic test case (test script) is faster compared to the manual execution of test case. Execution of test in un-attended mode. Once the entire automatic suite is ready for the execution, the automatic execution suite can be in an unattended mode (human attendance is not required for the entire execution). Consistency of test execution. Due to boredom of re-execution of regression suite several times we may miss to execute one or many finally lead to undetected bug!!! But, if we execute the automation suite, maybe for 1 out of 100 times it executes with the same efficiency and effectiveness. Reducing cycle time of regression test cycles.
Page | 6

Data driven testing. This feature helps to parameterize the data in the script which makes us get rid of hard-coding of the values required for the test. Also, this helps in the concept of re-testing of the functionality/test with multiple sets of input. Coverage. Test coverage can be increased using automation. Reusability of test wares. Some of the modules of automation test cases can be reused which helps in the reduction of the time required for automation and helps in increasing the test coverage and overall productivity. With the above benefits/advantages of automation, automation has actually become a part of entire project life cycle and more importantly Automation life cycle has become an important subset of entire Test life cycle. Note. To reap good benefits from Test Automation to the entire project, you need to have good planning and coordination from the Development Team, Manual Testing Team, Manual Testing Team and the Automatic Team. 2.5. Consideration in automation planning and area of Application

Stability of AUT (Automatic Under Test). Test automation is generally recommended for the application Size of regression suite. Test Automation is used if the size of the Regression Testing Cycles is long enough. Number of regression cycles to be performed. If the application is planned to have multiple builds/releases then automation is recommended else there will not be any RoI (Return on Investment). So, proper Cost-Benefit Analysis needs to be done before starting the automation implementation. Compatibility of Application Platform with Testing Tools (PoC). This is one of the most important factors. Before we decide our Automation Tool, we must be sure of whether our application can automate using this Tool, i.e., Is our application compatible with our application technology? Practically Speaking. Another important factor before selecting our automation tool is the Ability of skilled resources. The opted tool must not use any hi-fi technical skills to learn and implement.

Page | 7

2.6.

Test automation life cycle methodology

Functional Test Automation Life Cycle Methodology (FTALCM) comprises of 11 main phases:

Functional test automation life cycle methodology

Page | 8

Chapter 3 Functional Automation Test Framework


3.1. Objective
This project is used to Design and Development of the Functional Automation Test Framework. This framework is used to Test the application without human intervention. Automation Testing is used to overcome the drawbacks of Manual Testing (Time-Consuming, Tedious, Requiring a heavy investment in Human Resources).Worst of all, time constraints often make it impossible to manually test every feature thoroughly before the application is released. This leaves you wondering whether serious bugs have gone undetected. Automated Testing with QuickTest Professional (QTP) addresses these problems by dramatically speeding up the testing process so that we can create Tests that checks all aspects of your application or Web Site, and then run these tests every time your site or application changes.

3.2. Scope
"Test Automation Framework" is used to Test any kind of application like: Web, Standard Windows, .NET Windows Forms, etc. In our project we are focusing only the Web based application. In this framework user can user can execute the application/module by selecting a field in .xls (Microsoft Office Excel file format) file.

3.3. Functional Description


This Automation Framework design is generic to meet a range of specific and advanced testing needs. It combines a robust component model with an advance centralized access technique and is designed to promote reuse and extensibility. This framework enables Test script data preparation by even nontechnical users and thus has less dependency on Automation experts.

Page | 9

Components of Automation Framework: Run Manager: Run Manager is a start point for automation script. This enables automatic execution of end to end business test scenarios/test cases allocated to any specific tester of a project. Driver script: Driver scripts drive the test execution. It reads the Test Manager (master) file to identify the end to end business scenarios/test cases that need to be run. It reads the keyword test data step by step and executes those steps in the application using the automation scripting logic. Driver script calls the appropriate function for that keyword. Utility Scripts: The Utility scripts consist of parameterized generic functions and can be reused based on the nature of the application selected for automation. Utility scripts consists of functions that have been written to replace the common variables by corresponding Values and send e-mail in case of runtime error or once verification is completed. The Environment Variables contains list of environment variables such as Machine Name, Browser Name, Scenario Name, Error Number, Project Name, Application Type, etc. These variables are assigned value at run time. The Init Script contains the set of functions to set environment before automated test execution starts, Importing data from external database and invoke Application Under Test. Report Manager: Define a test result template such that the automation results are displayed in a unison and user friendly in identifying the defects appropriately. Object Repository: OR is used to collect the all the objects used in Test Automation.

Page | 10

3.4. Automation Framework Testing Process: Preparing to Record


Recording a Session on Application Enhancing Test Debugging Test Running Test Analyzing the Test Results Reporting Defects

3.5. Test Framework Architecture

Page | 11

3.6. Automation Test Life Cycle

3.7. Language Used


VB Script and VBA (Visual Basic of Application).

3.8. Tools to be used


QTPv10.0 (Quick Test Professional) product of HP Notepad++.

Page | 12

3.9. Supported Environments


Built-in: Web applications built in HTML or XML, running within Internet Explorer, Netscape, Firefox or AOL. Windows 2000, XP, 2003, Vista (for Windows 98, ME or NT, use Quick Test 6.5). Windows/Win32, Visual Basic, ActiveX. Via Add-Ins: WPF, .NET, Java, Oracle 11i, PeopleSoft 8, SAP 6.x, Siebel 7, Terminal Emulators (TE).

3.10. System Requirement


Computer/Processor: PC with a Pentium III or higher (Pentium IV or higher recommended) microprocessor. Operating System: Windows7, Windows Vista, Windows XP, Windows 2000, Windows Server 2003 and Windows Server 2008. Memory: Minimum of 512 MB. Color Settings: Minimum of High Color (16 bit). Graphics Card: Graphics card with 4 MB video memory (8 MB and above recommended) Free Hard Disk Space: 650 MB of free disk space for application files and folders, when only the default add-ins is installed. 800MB (recommended 1 GB) when all add-ins are installed.

Page | 13

Chapter 4 QuickTest Professional Course Overview


4.1. Overview of Test Automation
4.1.1. Introduction to Quick Test professional 4.1.2. Main Stages of Automation 4.1.3. Quick Test Window 4.1.4. Best practices to implement Automation

4.2. Automation Basics


4.2.1. Objects 4.2.2. Keyword View 4.2.3. Recording Views 4.2.4. Running Modes 4.2.5. Introduction to Web Objects

4.3. Scripts Basics


4.3.1. Data types 4.3.2. Variant subtypes 4.3.3. Variables 4.3.4. Constants 4.3.5. Operators 4.3.6. Conditional Constructs 4.3.7. Arrays 4.3.8. Procedures
Page | 14

4.4. Parameterization
4.4.1. Data Table 4.4.2. Environment Variables

4.5. QTP Checkpoint


4.5.1. Checkpoint 4.5.2. Standard checkpoint

4.6. QTP Actions


4.6.1. Actions and its Types 4.6.2. Inserting New Actions 4.6.3. Inserting existing Actions 4.6.4. Nested Actions 4.6.5. Splitting Actions

Page | 15

Chapter 5 Overview of Test Automation


5.1. Introduction to QuickTest Professional
The HP/Mercury advanced keyword driven testing solution. QuickTest Professional software is a Functional Test Automation Tool. It is a GUI Testing tool from HP Software (originally created by Mercury Interactive Corporation) that allows the automation of user action on several web based and client based application developed with variety of technologies. Overview QTP deploys the concept of knowledge driven testing to enhance test creation and maintenance. Keyword-driven testing is a technique that separates much of the programming work from the actual test steps so that the test steps can be developed earlier and can be maintained with only minor updates, even when the application or testing needs a significant change. QTP is widely used where regression testing is to be done. QuickTest professional is Unicode compatible and supports UTF-8, UTF-16 and Unicode 2.0, etc. By default QuickTest allows us to test: i. Standard Windows applications, ii. Web objects, iii. ActiveX controls, and iv. Visual Basic application. QTP Versions: From the past many versions of QTP have been launched. They are QTP 6.0, 6.5, 8.0, 8.2, 9.0, 9.1, 9.2, 9.5, and 10.00. Among all QTP 8.2 and QTP 9.2 are very successful and are used for most of the test automation projects.

Page | 16

Installation of QTP 9.2 The installation of QTP is very easy. You just need to click on the setup.exe application and provide the necessary license information when asked for. The installation process is very user-friendly. Initially or after the installation process, you need to install Microsoft Script Debugger in your machine, when QTP is installed. Installation of Microsoft Script Debugger enables some of the features of QTP. QTP 9.2 System Requirements The followings are the system requirements of QTP 9.2. It is to be noted that they are subjected to change as per HP norms. So do refer to companys website for updated requirements.
Computer/Processor Operating System IBM-PC or compatible with a Pentium III or higher (Pentium IV or higher recommended) microprocessor Windows 2000-Service Pack 4, Update Rollup 1 for Windows 2000 Service pack 4, Windows XP 32-bit Edition-Service pack 2, Windows XP 64-bit Edition-Service pack 1, Windows Server 2003 32-bit Edition-Service pack 1, Windows Server 2003 R2 (32-bit x86), Windows 2003 64-bit Edition, Windows Vista 32bit Edition, Windows 7 (Home Premium, Professional, Ultimate, etc., in any variant i.e., 32-bit or 64-bit) Minimum of 512 MB Minimum of High Color (16 bit) Graphics Card with 4MB of video memory (8MB and above recommended) 480 MB free (recommended 630MB) and additional 120MB of free space of system disk Microsoft IE 6.0 Service pack 1 or Microsoft IE 7.0 or later

Memory Color Settings Graphics Card Free Hard Disk Space Browser

Types of Licenses Demo license. This is a 14-day trial license. We can have it from HP and use for evaluating or learning about QTP. You can register on HPs site and download the trial version for learning or evaluating your project. Seat license. This is specific to the computer on which it is installed.
Page | 17

Concurrent license. This is network-based and can be used by many QuickTest users. QTP Add-in Manager The below are the default add-ins of QTP a. ActiveX b. Visual Basic c. Web

Add-in Manager

There can be other add-ins if the licenses are available a. Java Add-in b. .NET Add-in c. Oracle Add-in d. PeopleSoft Add-in e. Siebel Add-in f. Stingray Add-in g. Terminal Emulator Add-in h. VisualAge Smalltalk Add-in i. Web Services Add-in j. Add-in for SAP Solutions
Page | 18

When you click OK button you will be proceed to the welcome screen of QTP, which is like.

Start up Screen that appears while launching QTP

Start up Screen that appears after launching QTP

Update Notification

Page | 19

Uninstall QTP. Click on the Uninstall QTP. You can also uninstall from Control

Panel with the help of Uninstall feature. Documentation. This consists of tutorials and other help documents which assist you in learning QTP and in referring for any doubt or clarification Sample Application. When you click this you can find two applications- a web based application and a window based application. These applications are specially designed by HP subsidiary Mercury Interactive. The welcome screen of Mercury Tour website homepage is shown below.

Mercury Tours website homepage

Supported Environment Virtualization Technologies VMware workstation 5.5 Citrix MetaFrame Presentation Server 4.0 Standard Windows Application. QuickTest Professional supports testing on applications based on win32 API and MFC. QuickTest Professional does not support testing on 64-bit applications. Visual Basic Applications. QuickTest Professional supports testing on Visual Basics 6.0 applications
Page | 20

Note. Visual Basic .NET applications are supported by QuickTest Professional .NET Add-in Browsers Microsoft Internet Explorer 6.0 Service pack 1 Microsoft Internet Explorer 7.0 Netscape Browser 8.1.2 Mozilla Firefox 1.5 Mozilla Firefox 2.0

5.2. Main Stages of Automation

The above mentioned are the different stages advocated in case of automation using QuickTest Professional.

Page | 21

5.3. Quick Test Window

Main Window of QTP

The followings are some important components of QTP like bars, etc. Standard Toolbar.

View Toolbar.

Tools Toolbar.

Page | 22

Automation Toolbar.

Insert Toolbar.

Edit Toolbar.

Debug Tool.

Action Toolbar.

Page | 23

5.4. Best Practices to implement Automation


Some of the best practices while automating are as follows:

Open QTP first and then the application you want to automate. Use functions wherever there is a possibility of reusability. Using
functions is a better approach then using the concept of actions, as former is easy to maintain.

Use ExecuteFile to associate the function library to your test script.


Use Shared object Repository (and not Local Object Repository). Use descriptive programming whenever required (i.e., especially for dynamically changing objects). Use RepositoryCollection.Add to add shared object repository to your test script instead of manually associating the shared object repository. Use synchronization statement whenever you expect a delay in the operation in the next step. This will greatly reduce your last minute surprises during integrated test execution. Use parameterization and regular expression whenever required. Always try to separate the Test Script and Test Data by using appropriate parameterization techniques. Always try to deal with exception programmatically. You may opt for Recovery Scenario manager only when you are not able to deal with the expectation programmatically. Close the entire file objects excel object, database connections, etc., after their usage is completed. Also clear up the objects by setting them to Nothing when they are no longer required.

Page | 24

Chapter 6 Automation Basics


6.1. Objects
An object consists of:

Data that describes the object. Functions that can be performed on the object.
The types of objects that are created are defined by classes. QuickTest is also object-oriented.

QuickTest objects are defined by classes. Each class in QuickTest defines the properties and methods available
to its objects.

Each object contains the actual values for the properties. 6.2. Keyword View
Keyword View is an excellent feature in QTP. With the help of keyword view even non-technical Subject Matter Experts can automate most past of their test cases. It is especially very useful to Business Team and Business Analysts, who can automate their business functionality related test cases to a great extent with a minimal technical effort. Navigation, Click on the Keyword View. You can select the objects display or you can clock on the Object from repository and select the required object (as in the coming figure). Select the required operation for the object in the operation column.

Page | 25

Value from the Value column if required. You can get the required steps in the Keyword View along with a very good and clear documentation under the Documentation column. Also, if you click on the Expert View, you gat the corresponding code for the steps you have added in the Keyword View. You can also use Step Generator feature from Keyword View. If you have the object repository already available, it is very easy to create your automation test scripts. The following is the window showing Keyword View.

6.3. Recording Modes


There are basically three types of Recording Modes. i. ii. iii. Normal (default mode) Analog Low level

Page | 26

The alongside figure shows the Record and Run Setting Window.

6.4. Running Modes


The following are the running modes in QTP: i. Normal Run Mode: When we run a test in Normal Run Mode, QuickTest runs with the execution arrow (yellow color execution marker) to left of the Keyword View or Expert View, marking each step or statement as it is performed. We can specify the time in milliseconds that QuickTest should wait before running each consecutive step (up to a maximum of 10000 ms.) using Delay each step execution by option.

Note. We must have Microsoft Script Debugger installed to enable this mode. ii. Fast Run Mode: When we run test in fast run mode, QuickTest executes without the execution arrow to the left of the Keyword View or Expert View and also, QuickTest doesnt expand the item tree or display the script of each action as it runs.
Page | 27

Note. The Normal Run Mode option requires more system resources than the Fast run mode option. Navigation to Change the Run Mode. Tools -> options -> Select Run tab -> Select the required Run Mode. The following is the window showing both Fast Run Mode and Normal Run Mode. This window can be located by following the below mentioned instructions. In Options we can easily locate the Run tag. This is also grouped by the tags like, General, Folder, Active Screen, Window Application, Web, etc.

iii.

Update Run Mode: When we run test in Update Run Mode, QuickTest runs the test to update the test object description, the expected checkpoint values, and the Active Screen images and values. You can choose to update the data for an entire test or only part of it, according to the run and debug run options you select. After you save the test, the updates data is used for subsequent runs.
Page | 28

Navigation. Automation -> Update Run Mode -> Select Run tab -> Now you can select the required option like the ones below: Automation -> Run OR -> Run Current Action OR Automation -> Run from Step (For the Run from step, in the Expert View, it runs to the end of the current action. In the Keyword View, it runs to the end of the test.)

iv.

Debug Run Mode: This mode helps in step-by-step execution of the test script. This is useful in checking the correctness of script/finding where there is a problem in the script/testing whether the script runs smoothly or not.

Debug -> Step Into OR Debug -> Run to Step (Expert View only)OR Debug -> Debug from Step Note. For the Debug from Step, in the Expert View, it runs to the end of the current action. In the Keyword View, it runs to the end of the test.

6.5. Introduction to Web Objects Enter Data in an Edit Box


Browser(Register: Mercury Tours).Page(Register: Mercury Tours).WebEdit(firstName).Set Shashank

Select an Item from the Combo Box


Browser (Register: Mercury Tours).Page(Register: Mercury Tours).Weblist(country).Select INDIA

Page | 29

Click on The Link


Browser(Register: Mercury Tours).Page(Register: Mercury Tours).Link(Register here).Click

Click on the Image


Browser (Register: Mercury Tours).Page(Register: Mercury Tours).Image(register).Click

Click on a Web Button


Browser (Google).Page(Google).WebButton(Google Search).Click

Get Data from a Web Table


strCellData = Browser (Google).WebTable(Advanced Search).GetCellData(1,3)

Check a Check Box


Browser (Info).Page(Info).WebCheckBox(C1).Set On

Select a Radio Button


Browser (Google).Page(Google).WebRadioGroup(meta).Select #0

Page | 30

Chapter 7 Script Basics


VBScript is a scripting language. It is a subset of Visual Basic language. It was developed by Microsoft to provide more processing power to web pages. VBScript can be used to write both server side as well as client side scripting.

7.1. Data types


VBScript supports only one data type called, Variant. The variant data type is a special kind of data type that can contain different kinds of information. It is the default data type returned by all functions in VBScript. A variant behaves as a number when it is used in a numeric context and as a string when it is used in a string constant.

7.2. Variant subtypes


The different categories of information that can be contained in a Variant are called subtypes. The following table shows subtypes of data that a Variant can contain. Subtype
Empty Null Boolean Byte Integer Currency

Description
Variant is uninitialized. Value is 0 for numeric variables or zero-length string () for string variables. Variant intentionally contains no valid data. Contains either True or False Contains integer in the range 0 to 255 Contains integer in the range 32,678 to 32,767 -922,337,203,685,477,5808 to 922,337,203,685,477,5807
Page | 31

Long Single

Contains integers in the range -2,147,483,648 to 2,147,483,647 Contains a single-precision, floating-point number in the range -3.40282E38 to -1.401298E-45 for negative values; 1.401298E-45 to 3.402823E38 for positive values. Contains a single-precision, floating-point number in the range -1.79769313486232E308 to -4.94065645841247E-324 for negative; 4.94065645841247E-324 to 1.79769313486232E308 for positive values. Contains a number that represents a date between January 1,100 to December 31, 9999. Contains a variable-length string that can be up to approximately 2 billion characters in length. Contains an object. Contains an error number.

Double

Date (Time) String Object Error

7.3. Variables
A variable is a value stored in memory. It is the name that represents an address containing information stored in the memory. Variable Declaration, Scope and Lifetime Variables in VBScript can be declared in three ways: i. Dim Statement ii. Public Statement iii. Private Statement For example, Dim intTicketNo You can also declare multiple variables at once by separating each variable name with a comma. Example, Dim intTicketNo, strName, blnFlag Variables declared with Dim at the script level are available to all procedures within the script. At the procedure level, variables are available only within the procedure. Public statement variables are available to all procedures in all scripts. Private statements variables are available only to the script in which they are declared.
Page | 32

Naming Rules There are standard rules for naming variables in VBScript. A variable name: Must begin with an alphabetic character. Cannot contain an embedded period. Must not exceed 255 characters. Must be unique in the scope in which it is declared.

Assigning values to variables


Syntax, variableName = variableValue Example,

intNoOfTicket = 5 strName = Shankar

Scalar Variables and Array Variables


Scalar Variable. A variable containing single variable. Array Variable. A variable that can contain a series of values.

Array variables and scalar variables are declared in the same way, except that the declaration of an array variable uses parenthesis () following the variable name. In the following example, a single-dimension array containing 11 elements is declared. Dim A(10)

7.4. Constants
A constant is a meaningful name that takes the place of a number of strings, and never changes. VBScript in itself has a number of defined intrinsic constants like vbOK, vbCancel, vbTrue, vbFalse and so on. You can define user-defined constants in VBScript using Const statement. Using the Const statement, you can create string or numeric constants with meaningful names and assign them literal values.

Page | 33

Example, Const AUTHOR = SHANKAR Const TICKETS = 5 Note: The string literal is enclosed in quotation marks (). The constants are public by default. Within procedures, constants are always private; their visibility cannot be changed.

7.5. Operators
VBScript has a full range of operators, including arithmetic operators, comparison operators, concatenation operators and logical operators. Arithmetic Operators Name
Exponentiation Unary Negation Multiplication Division Integer Division Modulus Division Addition Subtraction String Concatenation ^ * / \ % + __ &

Symbol

Concatenation Operators There are 2 types of such operators. They are + and &. Although we can use + operator to concatenate two character strings, we should use & operator for concatenating to eliminate ambiguity. Because in case of numeric data + will perform addition instead of concatenating.
Page | 34

Comparison Operators Name


Equality Inequality Less Than Greater Than Less Than or Equal To Greater Than or Equal To Object Equivalence = <> < > <= >= Is

Symbol

Logical Operators Name


Logical Negation Logical Conjunction Logical Disjunction Logical Exclusion Logical Equivalence Logical Implication Not And Or Xor Eqv Imp

Symbol

7.6. Conditional Constructs


The followings are different types of Conditional Constructs used in VBScript: If-Then-Else Construct Select Case Statement DoLoop WhileLoop ForNext For EachNext

They also perform the same task as they perform in C and C++.

Page | 35

7.7. Arrays
An Array is a contiguous area in the memory referred to by a common name. It is a series of a variable having the same data type. They are used to store related data values. VBScript allows sharing a group of common values together in a same location. These values can be accessed with their reference numbers. An array is made up of two parts, the array name and the array subscript. The subscript indicates the highest index value for the elements within the array. Each element of an array has a unique identifying index number by which it can be referenced. VBScript creates zero based arrays where the first element of an array has an index of zero. Declaring Arrays. An array must be declared before it can be used. Depending upon the accessibility, arrays are of two types: Local Arrays and Global Arrays. Local Arrays. A Local Array is available only within the function or procedure, where it s determined. Global Arrays. A global array is an array that can be used by all function and procedures. It is declared at the end of the VBScript Code. The Dim statement is used to declare arrays. The syntax is as follows. Syntax- Dim ArrayName(subscriptvalue) Static and Dynamic Arrays. A static array has a specific number of elements. The size of a static array cannot be changed at the run-time.

Page | 36

A dynamic array can be resized at any time. Dynamic arrays are useful when size of the array cannot be determined. The array size can be changed at run-time.

7.8. Procedures

In VBScript, there are two types of procedures: i. Sub procedures. They do not return any value. Example, Sub sayHello() MsgBox Hello End Sub ii. Functional Procedures. They can return a value. Example, Function fbAddTwoInt(a,b) fbAddTwoInt = a+b End Function

Page | 37

Chapter 8 Parameterization
By replacing fixed values with parameters, QuickTest enables you to enlarge the scope of a basic test. It is known as parameterization. It greatly increases the power and flexibility of a test. A parameter is a variable that is assigned a value from an external data source or generator. Values in steps and checkpoints and also the values of action parameters can be parameterized. There are basically four types of parameterization, which are as follows: a. b. c. d. Test/Action parameterization. Data Table parameterization. Environment parameterization. Random Number parameterization.

Out of the above all parameterization types we will discuss only Data Table and Environment parameterization.

8.1. Data Table Parameterization


They allow us to create a data-driven test (or action) that runs several times using the data that we supply. In each repetition or iteration, QuickTest uses a different value from the data table.

Parameterization of test object description

Page | 38

The above figures show how we can parameterize the values of the Object Properties.

8.2. Environment Parameterization


They allow us to use variable values from other sources during the run session. These may be values that you supply, or values that QuickTest generate for you based on calculations and options we choose. We can store test data in an xml file and load it to our script and use it. QTP provides two types of environment parameterization: Built-in. Built-in environment variables are available in QTP by default. We can view the available built-in variables by using the following path: Navigation. File -> Setting -> Environment -> Select variable type: Built-in You can also write a statement like the one below, to access the environment variable in your test script.

strOS = Environment.Value(OS) This fetches the name of the OS you are using.

Page | 39

User-defined. We can define internal environment variables and even load an external environment file. Navigation. File -> Setting -> Environment -> Select variable type: User-defines -> Click on the + symbol and add the required Internal User Defined environment variables. This is shown as below.

Page | 40

Chapter 9 QTP Checkpoint


During automation, scripting, you face several situations where you need to check the properties of objects or count the number of links in a page, etc. to automate such cases, QTP provides Checkpoints, with the help of which you can check for the required properties, compare the actual values from the AUT with that of the expected values.

9.1. Checkpoint
A checkpoint is a verification point that compares a current value for a specified property with the expected values for that property. This enables you to identify whether the application is functioning correctly. The followings are several types of check points of QTP.
Checkpoint Type Standard Checkpoint Image Checkpoint Table Checkpoint Page Checkpoint Description Checks values of an objects properties. Checks the property values of an image. Checks information in a table. Checks the characteristics of a web page. Checks that a text string is displayed in the appropriate plane in a Web page or the application. Checks that a text string is displayed in the appropriate place in a Web Page or application. Checks an area of a Web page or application after capturing it as a bitmap. Example of Use Check that a radio button is selected. Check that the image source file is correct. Check that the value in a table cell value is correct. Check how long web page takes to load or if a web page contains broken links. Check whether the expected text string is displayed in the expected location in a test object. Check that an area of a dialogue box includes text that was entered in another part of the application. Check that a web page (or any portion of it) is displayed as expected.

Text Checkpoint

Text Area Checkpoint

Bitmap Checkpoint

Page | 41

Database Checkpoint Checks the contents of databases accessed by an application or Web Site. Accessibility Checkpoint Identifies area of a web page t check for the section 508 compliancy.

Check that the value in a database query is correct. Check if the images on a Web page include ALT properties, required by the W3C Web Content Accessibility Guidelines. Check the content of an element to make sure that its tags, attributes and values have not changed. Note. XML file checkpoints are used to check a specified XML file; XML application checkpoints are used t check an XML document within a web page.

XML Checkpoint

Checks the data content of XML documents.

Checkpoints cannot be added manually, they are inserted into QTPs interface. Test Result Window shows the result of checkpoint. Checkpoint information is stored in the Resource.mtr file which is in the corresponding action folder (if you created action in action 1folder under the folder in which you are saving the test script, if you created checkpoint in actions 2 then it will be action 2 folder and so on). In the expert view, on the blank line, type Checkpoint and put (. As soon as you put the starting bracket it will show the checkpoints you have used in the test. Important Note. It is not that checkpoint is the only way through which can check for our required properties and their values, you can also do that through writing scripts which do the same. These alternatives methods are anyhow discussed for every checkpoint below.

9.2. Standard Checkpoint


Standard Checkpoint checks the property values of an object in your application. The standard checkpoint checks a variety of objects such as buttons, radio buttons, combo boxes, lists, etc.

Page | 42

Say, if you want to check if the login button is enabled after entering the username and password, then you create a standard checkpoint on the login button to check for the property called enables and the values either true or False.

Page | 43

Chapter 10 QTP Action


10.1. Actions and its types

Action bring up the test script Modularity concept in QTP. There are many benefits of script modularity like code reusability, script maintainability, efficiency, and of course, reduction in script development time. Actions enable us to break up the script into logical sections/units such as specific activities that you can perform in your application. When you create new test, it contains a call to one action. By breaking up the test into calls to multiple actions, you can design more modularity, well organized and professional tests. An action has its own test script, containing all the steps recorded in that action, and all objects in its local object repository. An action is stored with the test in which you created it. There are basically three types of tests in QTP, which are as follows:

A non-reusable action can be called only once and that too in the test with which it is stored. Reusable action can be called multiple times by the test in which it was created (the local test) as well as by other tests. They are like functions in any programming language. Deleting a reusable action that is called by other tests will cause those tests to fail. External action is reusable action stored with another test. They are read-only in calling test, but you can choose to use a local, editable copy of Data Table information for external action with the help of Action Properties as shown in the following figure:

Page | 44

10.2. Inserting a New Action


Whenever you open a new test, Action1 is available by default. If a new action needs to be inserted, the below navigation is followed: Navigation. Insert -> Call to New Action OR Right Click on the editor -> Action -> Insert Call to Ne After following the above steps, the following screens pops up.

Insert call to new Action

Page | 45

We can enter the appropriate name, description and select the location where it needs to be inserted.

10.3. Nested Actions


Sometimes, you may want to run an action within an action. This is called nesting. Nesting actions help you to maintain the modularity of your test. They enable you to run one action or another based on the results of a conditional statements.

Page | 46

Training Experience
The company is providing quality service related to training at all levels for their trainees. Based on the analysis of the data it can be concluded that the companys professionally conducting Training Development and Management Development program to constantly upgrade the skill and knowledge of its trainees. In the modern competitive business environment every company should try to increase the productivity and maintain quality of its products. In order to be competitive in the market the company should constantly upgrade in Training and Development program and its methodology. A significant majority of the training program offered by the company has helped the trainees to increase their knowledge and skills. Due to this it has achieved greater height of success. It is also observer that the training is provided by Industrial Experts, which is a great option in itself. They are quite well behaved and polite and rich in professional excellence. The overall experience was excellent.

Page | 47

Abbreviations
1. 2. 3. 4. 5. 6. 7. 8. 9. AUT FTALCM HP HTML LR OTA Poc QC QTP Automation Under Test Functional Test Automation Life Cycle Methodology Hewlett Packard Hyper Text Markup Language Load Runner Open Test Architecture Proof of Concept Quality Center QuickTest Professional Return of Investment eXtensible Markup language

10. RoI 11. xml

Page | 48

References
BOOKS: 1. QuickTest Professional (covers QTP 9.2, 9.5 and 10.00) By- Vinnakota Ravi Sanskar (Tata McGraw Hill) Mastering Visual Basic 6 By- Evangelos Petroutosos (BPB Publication)

2.

WEBSITES: 1. 2. 3. 4. 5. www.wikipedia.com www.google.com www.cromacampus.com www.adobe.com support.mercury.com

Page | 49

You might also like