You are on page 1of 100

QTP PRESENTATION

SESSION OBJECTIVES
Introduction to Automation Benefits of Automated Testing Automated Testing Process Introduction to QTP and its Salient Features Environment Supported

WHAT IS AUTOMATION
A software program that is used to test another software program, this is referred to as Automated software testing. Test Automation is the use of software to control the execution of tests & the comparison of results- actual with the predicted/expected. A third party tool is used to test the application. Use of automation tools reduces the test time as well as the cost

WHY AUTOMATION
Avoid the errors that human make when they get tired after multiple repetitions. The test program wont skip any test by mistakes. Each feature test cycle will take less time & Required less human intervention. Required for Easy cycle of Regression Testing.

BENEFITS OF TEST AUTOMATION


Allows more testing to be done. Strengthen Test Cycle. Testing is Consistent, repeatable. Fast, Reliable, Repeatable, Programmable, Comprehensive, Reusable.

FALSE BENEFITS
Fewer tests will be needed It will be easier if it is automated Compensate for poor design No more Manual Testing

WHICH TEST CASES TO AUTOMATE?


Tests that need to be run for every build of the application (sanity check, regression test) Tests that use multiple data values for the same actions (data driven tests)

WHICH TEST CASES NOT TO AUTOMATE?


Usability testing

"How easy is the application to use?"

One-time testing "ASAP" testing


"We need to test NOW!" based on intuition and knowledge of application

Ad hoc/random testing

WHAT ARE THE DIFFERENT TOOLS AVAILABLE IN THE MARKET (FOR FUNCTIONAL TESTING) Rational Robot Win Runner QTP Silk Test QA Run Web FT

VERSION HISTORY OF QUICKTEST PROFESSIONAL


Astra QuickTest (Mother tool of QTP) 1.0 to 5.0

Quick Test Professional 5.6 Nov 2002 6.5 2003 8.0 2004 8.2, 8.3 2005 9.0,9.1-2006 9.2- 2007 Mercury Interactive 9.5 2008 H.P 10.00 2009 January

BASIC FEATURES OF QTP


QTP Launched in 2002 (Nov). By Mercury Interactive. Later taken over by HP, in 2007. QTP is an Object Based Testing Tool. (Object based means; QTP Follows Test Object Model for Performing Testing operations. Based on either Test Objects or Automation Objects or Utility Objects only, we can automate test operations) QTP is for Functional and Regression Testing. (Basically QTP is a Functional and Regression Test tool but we can use it for little bit Compatibility Testing and Performance Testing). It follows Keyword Driven Approach. (Keyword Driven Approach means; Keywords example Commands, functions, methods, statements etc.. are used for creating Test scripts) It supports Windows Operating Environment only. (QTP basically depends on User Interface to automate test operations and it is not depends on server side interactions, where as LoadRunner depends on server side Operations, so HP developed LoadRunner for Windows as well as UNIX versions). It supports GUI based (Graphical user interface) and Web based Applications Automation, does not support CUI (Command user interface) Applications. It has multilingual support. (It supports English, Chinese, Japanese, Korean, etc languages with respect to license.) It has adapted Microsoft Visual Basic Scripting edition for programming and Excel like spread sheet for Data driven testing.

OTHER SALIENT FEATURES


QTP can automatically introduce Checkpoints During execution testers can manually insert several types of check points to verify that the objects continue to behave as expected. Testers are able to record their tests so that each action, or step in the business process are modular & reusable. When application under test changes, testers can update Object Repository, thus the change made is then propagated across all the scripts that reference to this object

EX: In the Authentication screen when the name of the button is changed to Sign In form Login, Just make an update in the Object Repository.

CONTD.
After running a test QTP displays the results in a tree structure and in clear visual reports Scripting Language is VBScript which is easy to use , understand and program even complex functionalities with ease. Library files contains VBScript functions and subroutines that can be added to the test.

ADD-IN MANAGER

ADD-INS

Default
ActiveX y Visual Basic y Web
y

Additional
y y y y y y

Java Oracle PeopleSoft .NET Terminal Emulator Sap, Siebel & Web services

WHAT TYPE OF TOOL IS QTP


y y y y

Record and playback tool It has additional features like sync pt, check pt, output values It has Built in functions It has User defined functions , Registered functions.

ENVIRONMENTS SUPPORTED

Browsers
Netscape y Internet Explorer y AOL
y

Operating Systems
y y y y y

Windows XP/2003 Windows 2000 Windows 98 Windows NT Windows ME

TYPES OF VIEWS IN TEST PANE


Two types Keyword view Actions are generated in tabular format similar to manual test cases Expert view Actions are generated in VB scripting

KEYWORD VIEW

EXPERT VIEW

QUICKTEST TESTING PROCESS


The Quick Test testing process consists of 7 main phases:


Preparing to record Recording a session on your application Enhancing your test Debugging your test Running your test Analyzing the test results Reporting defects

RECORD USER ACTIONS

START RECORDING ON ANY WEB SITE. CHOOSE TEST > RECORD OR CLICK
THE

RECORD BUTTON. THE RECORD AND RUN SETTINGS DIALOG BOX

SAVE THE TEST


The test can be saved into a Windows file system (as below). If TestDirector is available and connected with QTP, the test can be saved there. QTP creates an entire structure of files and directories to support a single QuickTest script for each saved test.

VERIFY SUCCESSFUL PLAYBACK


Use the Run button to begin playback from the top of the test. Select the location of the test results- either a new results folder or a temporary folder.

VIEWING THE TEST RESULTS


Test results can be stored in their own location (for documentation) or in a temporary location that is overwritten each time the test is run (debugging).

MODES OF RECORDING
Normal

mode recording based on properties of GUI Analog mode mouse movements, clicks, keyboard strokes Low level records any object irrespective of support from QTP. Recognizes all run time objects as windows objects. It is used when an object is not identified by Quick test and co-ordinates based.

RUNNING A SESSION

The Run option can be used to run the test from start to end. The Run from Step option in the Test menu is used to run the test from a selected step to the end of the current action, if running from the Expert View, or to the end of the test , if running from the Keyword View. Thus it enables us to check a specific part of the application or to confirm that a certain part of the test runs correctly.

HOW QUICKTEST WORKS WITH OBJECTS


What are Object Properties? A set of characteristics that defines an objects appearance, values, state and identity in an application.
y y

QTP captures these object properties during recording. Logical Name Logical name is a value QuickTest usually takes from one of the object properties (like TEXT) to refer to the object in the recorded script.

OBJECT REPOSITORY
Object

Repository is nothing but a storage location. It contains the collection logical name and physical description of a particular object.
Object Repository is a location within the test structure where QuickTest stores object information captured during recording. The Object Repository can be used to: y Rename logical names for readability. y Add a new object in the repository. y Configure the object properties used to identify an object.

While

playback of scripts, qtp refers object repository for identifying the objects

OBJECT REPOSITORY
Two

types Per action, Shared Repository The Object Repository can be Per Action or Shared. The shared repository can be used by multiple actions of the same test or by actions from different tests. Test object properties are prone to frequent updation. Per Action object repository is used by one or very few tests. Test object properties are modified less frequently.

OBJECT REPOSITORY

OBJECT RECOGNITION
Mandatory properties QTP always learns for differentiating objects Assistive properties optional properties learnt when mandatory couldnt able to differentiate

OBJECT RECOGNITION
Ordinal

Identifier This is used when both mandatory and assistive couldnt help to differentiate objects Ordinal identifier uses location indicator and index indicator to differentiate objects

OBJECT IDENTIFICATION
Object

identification is another component in QTP. This is used to configure the mandatory and assistive properties depending on application to be tested.

OBJECT IDENTIFICATION

WHAT ARE TYPES OF PROPERTIES?


Test object Properties learnt by QTP while recording that is used for mapping with actual objects Runtime Properties of actual object in the application

OBJECT SPY
Object

spy is a component in QTP that helps to list the test object and runtime properties of the GUI Lists the methods and syntax that could be implemented on that particular object Lists the hierarchy of the object in the AUT

CHECKPOINTS IN QTP

A checkpoint is a verification point that compares a current value for a specified property with the expected value for that property.

TYPES OF CHECKPOINTS
Standard Checkpoint Bitmap checkpoint Text checkpoint Text Area checkpoint Database checkpoint XML Checkpoint

TYPES AND THEIR USE


Standard Checkpoint

Bitmap Checkpoint

Checks the property value of the object in an application or Webpage. It checks buttons,Radiobuttons,C omboboxes etc Checks the value of an image in the application.

Text Checkpoint

Checks whether the text string is displayed in the appropriate place in your application or on a Web page

Database Checkpoint

Checks the contents of a database accessed by the application Checks the data content of XML documents in the application.

XML Checkpoint

WHEN TO USE CHECKPOINTS


Before creating checkpoints on web objects we have to select web-test option in ADD-IN Manager. If the objects developed in HTML we can use Standard Check point. If the Objects developed in XML we can use XML Check point.

HOW CHECKPOINTS WORK - PLAYBACK


Script
Test Results PASS

Expected Result
Actual = expec ted ?

Execute checkpoint Object: Button Logical Name : OK Property: Enabled Value: True

SAMPLE OBJECTS THAT QUICKTEST CAN VERIFY


WINDOWS
Window Edit Field Drop down list Menu command Radio Button Checkbox Windows Object Status Bar Text Area

WEB
Browser Text Area Text Link Images Image Link Edit Field Drop down list Checkbox Radio Button Tables/ Grids Web Element

HOW TO ADD A CHECKPOINT


1. Select the object in the Active Screen 2. Right Click on it and Select Insert Standard Checkpoint or Menu Insert Checkpoint Standard Checkpoint

HOW TO ADD A CHECKPOINT SET


EXPECTED VALUE

Do not automatically select the pre-defined list of properties to check. Scroll down the property list to find the property( or properties) that best meets the test requirement.

TABLE CHECKPOINT

DATABASE CHECKPOINT

Choose Insert > Checkpoint > Database Checkpoint. The Database Query Wizard opens.

DATABASE CHECKPOINT ..CONTD

HOW TO ADD A CHECKPOINT TEST RESULT

OUTPUT VALUES
Outputs

the value of properties of GUIduring runtime Can be viewed in runtime data table in results window Mainly used to get collection of property value of dynamic objects

PARAMETRIZATION
Parameterization - Passing multiple set of values for testing A parameter is a variable that is assigned a value from an external data source at run time. We use parameterization when we want to change the value of properties at run time.

HOW CAN WE PARAMETRIZE?


Identify the fixed value that needs to be parametrized Replace with parameter Passing value from data table

WHAT IS DATA TABLE


Inbuilt

XL sheet in QTP for passing values to parameters in runtime Two sheets global and action Global Data is passed to all actions within the script Action Data is passed to only particular action

WAYS TO PARAMETRIZE..
Data

table parameter Passing through data table Action/component parameter By declaring input and output parameter in action properties Environment parameter External host, url, vuser etc

DATATABLE PARAMETERS
The

Test runs once for each line of data in the DataTable. Each iteration takes a different value from the datatable. choose the Run tab Test Settings

Specify an option in the Datatable iterations frame.

ENVIRONMENT VARIABLE PARAMETERS


The Environment variables can have Quick Test generated values or values supplied from external files. Test Settings Environment Choose User-defined from the variable type Click New to create your own internal variables

RANDOM NUMBER PARAMETERS


It enables us to use random numbers as values in the test. We can specify the range from which the random number is generated. By default, the random number range is between 0 and 100.

HOW TO PARAMETERIZE AN INPUT VALUE

Select the step in the Tree View that contains the recorded input value. Click on the text under Value column.

HOW TO PARAMETERIZE AN INPUT VALUE CONTD.


-Select the source for paramterization. -Select the parameter name. -Select the data sheet to use.

HOW TO PARAMETERIZE AN INPUT VALUECONTD

ACTIONS
A test is composed of actions or logical sections. The steps we add to the test are added within the tests actions. By default, each test begins with a single action. When we run a test with multiple actions, the Test Results are divided by actions so that we can view the detailed results for each action individually. Each action has its own sheet in the Data Table so that we can insert data that applies only to that action.

TYPES OF ACTIONS
Non-re-usable: Action can be used in the local test, only once. Reusable: Action can be used in the local test, multiple times. External: These are reusable actions created in another test. This can be of two types. If a call to an external action is used the action is read only in the calling test. But, any existing action can be inserted as a copy of the original action. In this case, we can modify this copy of the external action in the calling test.

CALLING ACTION
INSERT

CALL TO EXISITING ACTION CALLS A REUSABLE ACTION, BUT ANY CHANGES WILL BE REFLECTED ON ORIGINAL CALLED ACTION INSERT CALL TO COPY OF ACTION CALLS A REUSABLE ACTION, BUT CHANGES ARE NOT REFLECTED ON ORIGINAL CALLED ACTION

HOW TO SET AN ACTION AS REUSABLE

HOW TO CALL A REUSABLE ACTION

Insert Call to existing Action

TRANSACTIONS
TRANSACTIONS

ARE NOTHING BUT TIMER FOR MEASURING TIME TAKEN FOR EXECUTING PARTICULAR TASK SERVICES.START TRANSACTION T1 SERVICES.END TRANSACTION T1 CAN BE USED ANY NUMBER OF TIMES

DEBUGGING
DEBUGGING FINDING ERRORS IN THE SCRIPT BREAKPOINTS POINT WE CREATE IN THE SCRIPT WHERE THE EXCUTION OF SCRIPT IS PAUSED WATCHLIST MAINLY FOR BETTER DEBUGGING. USED TO VIEW THE VALUES OF THE PARAMETERS/VARIABLES DURING RUNTIME

HOW TO HANDLE CUSTOM OBJECTS???


SOLUTION IS VIRTUAL OBJECT WIZARD THIS HELPS TO MAP THE CUSTOM OBJECT WITH THE STANDARD GUIS. HENCE WHILE RECORDING QTP RECOGNIZES EVEN THESE NON STANDARD OBJECTS

HANDLE THE CHANGING WINDOWS/ OBJECT PROPERTIES??


THE SOLUTION IS REGULAR EXPRESSION REGULAR EXPRESSION IS AN EXPRESSION THAT MAKES QTP TO RECOGNIZE THE OBJECTS THAT HAVE VARYING PROPERTY DURING RUNTIME

REGULAR EXPRESSION
\

SYMBOL TO INDICATE IT IS AN REGULAR EXPRESSION . PERIOD MATCHES ONE CHARACTER !WELCOME. CAN MATCH WELCOMES, WELCOMED * - MATCHES ANY NUMBER OF CHARACTER !W*-WHO, WE [] TO INDICATE COLLECTION LIKE !W[E3] WE, W3

REGULAR EXPRESSIONS
-

INDICATES RANGE LIKE [0-9] ^ INDICATES EXCLUSION LIKE [^A-Z] WILL NOT ACCEPT UPPER CASE ALPHABETS + indicates one or more occurrence of preceding character ca+r car, caaar and not cr \w matches all characters except alphanumeric and underscore

WHAT ARE EXCEPTIONS???


EXCEPTIONS ARE NOTHING BUT UNEXPECTED ERRORS THAT CAUSES HINDERANCE DURING THE EXECUTION OF SCRIPTS COULD BE DUE TO POP UPS, OBJECT PROPERTY CHANGE, APPLICATION CRASH, TEST RUN

HOW TO HANDLE EXCEPTION???


SIMPLE USING RECOVERY SCENARIO MANAGER. RECOVERY SCENARIO MANAGER IS A WIZARD THAT GUIDES STEPS TO HANDLE EXCEPTIONS

RECOVERY SCENARIO MANAGER


THREE STEPS TRIGGER EVENT DEFINE THE EXCEPTION RECOVERY OPERATION DEFINING THE HANDLER FUNCTION POST RECOVERY OPERATION.

FUNCTION? PROCEDURE???
FUNCTION CAN BE INBUILT OR USER DEFINED. IT IS ONE THAT RETURNS A VALUE PROCEDURE IS SIMILAR TO FUNCTION BUT DOESNT RETURN VALUE

SOME IMPORTANT FUNCTIONS SETTOPROPERTY


SETTOPROPERTY() PROPERTYNAME, VALUE DIALOG(Login).WinEdit(Username).SETTOPR OPERTY(Enabled,True)

GETTOPROPERTY()
GetTOProperty( propertyname) Returns the value of the property Example, A= Dialog(Login).Winbutton(OK).GetTOProperty (Enabled)

GETTOPROPERTIES( )
GetTOProperties() Lists all the properties and property values of particular object

GETROPROPERTY()
GetROProperty(Propertyname) Returns the runtime property of the particular object Dim a A= dialog(login).Winbutton(OK).GETROPROPER TY(nativeclass)

CAN WE CONNECT DATABASE THROUGH QTP???


Answer

is yes not through wizard but through scripting Set a = createobject(ADODB.connection) A.openDSN = Employee.mdb, Username = xxx, Password = xxxx Set b = createobject(ADODB.RecordSet) B.openSelect * from table1,a Msgbox b.recordcount

FILE HANDLING
Using QTP it is possible to pass datas from various files and write data into file Example to read data from a file Set a = createobject(Scripting.FileSystemObject) Set b = a.opentextfile(path,0/1/8,true) Str = b.readline 0 write mode 1- read mode 8 append True/false file exist or create new

CHILDOBJECTS()
This function is used to return the list of all objects within the window Example to count no of objects within dialog Set c = dialog(Login).childobjects() Msgbox c.count

POPUP()
POPUP(MSG,WAIT TIME, TITLE,BUTTON) EXAMPLE SET A = POPUP(HI,10,GREETING,4) A WILL BE RETUNED VALUE 6(YES) AND 7(NO)

MAXIMIZE WINDOW
MAXIMIZE IS KEYWORD FOR MAXIMIZING WINDOW/DIALOG FULLSCREEN IS THE KEYWORD FOR MAXIMIZING THE BROWSER

DATATYPE CONVERSION
CINT() CONVERTS VAR TO INTEGER CLNG() CONVERTS CURRENCY TO INTEGER CCUR()- CONVERTS TO CURRENCY FORMAT

IS IT POSSIBLE TO OPEN APPLICATION THROUGH SCRIPTING??? YES!!!


SYSTEMUTIL.RUN PATH FOR OPENING ANY APPLN INVOKE PATH FOR EXE APPLICATION EXECUTE PATH

USER DEFINED FUNCTION


FUNCTIONS THAT ARE REPEATED FOR MANY TIMES EXAMPLE PUBLIC FUNCTION SUM(X, Y, Z) Z = X+Y END FUNCTION DIM A, B, C A = INPUTBOX (ENTER A) B = INPUTBOX(ENTER B) SUM (A,B,C) MSGBOX C

FRAMEWORKS
FRAMEWORKS ARE SET OF DEFINED RULES FOR AUTOMATING A TESTING PROCESS IT COULD BE SAID AS AUTOMATION TEST APPROACH

FRAMEWORKS
LINEAR

FRAMEWORK RECORDING, ENHANCEMENT , PLAYBACK HERE U CREATE SCENARIOS, DO RECORDING BASED ON SCENARIOS, ENHANCEMENT IS DONE FOR VERIFICATIONS, AND PLAYBACK FOR EXECUTION

FRAMEWORK
DATA DRIVEN HERE AN EXTERNAL DATABASE IS MAINTANINED FOR PASSING VALUES TO THE ACTIONS IN QTP VALUES ARE COMPLETELY PASSED ONLY THRO THIS DATA SETS

FRAMEWORK

KEYWORD DRIVEN USING THE MANULLY ENTERED TABLE THAT DEFINES TESTOBJECT, OPERATION, DATA AND DESCRIPTION, VB SCRIPTS ARE AUTOMATICALLY GENERATED BY QTP

FRAMEWORK
DESCRIPTIVE

PROGRAMMING IT IS A CONCEPT OF EXECUTION OF SCRIPTS WITHOUT THE REFERENCE OF OBJECT REPOSITORY DIALOG(CLASS = DIALOG,CAPTION = Login).Winbutton(class = Button,Text = OK).Click

FRAMEWORKS
FUNCTIONAL/MODULAR HERE THE ACTIONS ARE DECLARED AS USER DEFINED FUNCTIONS THESE FUNCTIONS ARE CALLED WHEREVER NEEDED.

FRAMEWORK
HYBRID FRAMEWORK MIX OF ANY OF THE ABOVE FRAME WORKS ARE CLASSED AS HYBRID. DEPENDING ON COMPLEXITY OF THE APPLICATION, MIXES ARE CHOSEN.

You might also like