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

. 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.WHY AUTOMATION Avoid the errors that human make when they get tired after multiple repetitions.

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

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

regression test) Tests that use multiple data values for the same actions (data driven tests) .WHICH TEST CASES TO AUTOMATE? Tests that need to be run for every build of the application (sanity check.

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 .

5 ² 2003 8.P 10.0 to 5.0.9.1-2006 9.0 ² 2004 8.2.2007 Mercury Interactive 9.5 ²2008 H.2.VERSION HISTORY OF QUICKTEST PROFESSIONAL Astra QuickTest (Mother tool of QTP) 1.00 ²2009 January .0 Quick Test Professional 5.6 ² Nov 2002 6.3 ²2005 9. 8.

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

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 . Siebel & Web services .NET Terminal Emulator Sap.

. output values It has² Built in functions It has ² User defined functions . Registered functions. check pt.WHAT TYPE OF TOOL IS QTP y y y y Record and playback tool It has additional features like sync pt.

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 .

THE RECORD AND RUN SETTINGS DIALOG BOX . CHOOSE TEST > RECORD OR CLICK THE RECORD BUTTON.START RECORDING ON ANY WEB SITE.

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

Select the location of the test results.VERIFY SUCCESSFUL PLAYBACK Use the µRun¶ button to begin playback from the top of the test. .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). .

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

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 object¶s 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

Test object properties are modified less frequently. Per Action object repository is used by one or very few tests. .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.

OBJECT REPOSITORY .

OBJECT RECOGNITION Mandatory properties ² QTP always learns for differentiating objects Assistive properties ² optional properties learnt when mandatory couldn·t able to differentiate .

OBJECT RECOGNITION Ordinal Identifier ² This is used when both mandatory and assistive couldn·t 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 .

Radiobuttons.TYPES AND THEIR USE Standard Checkpoint Bitmap Checkpoint Checks the property value of the object in an application or Webpage. . It checks buttons.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 .

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

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 .

Right Click on it and Select ¶Insert Standard Checkpoint· or Menu Insert Checkpoint Standard Checkpoint . Select the object in the Active Screen 2.HOW TO ADD A CHECKPOINT 1.

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 .

.

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

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.. vuser etc« . Data table parameter ² Passing through data table Action/component parameter ² By declaring input and output parameter in action properties Environment parameter ² External host. url.

DATATABLE PARAMETERS The Test runs once for each line of data in the DataTable. . choose the Run tab Test Settings Specify an option in the Datatable iterations frame. Each iteration takes a different value from the datatable.

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

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

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. .

-Select the parameter name. -Select the source for paramterization. . -Select the data sheet to use.HOW TO PARAMETERIZE AN INPUT VALUE« CONTD.

HOW TO PARAMETERIZE AN INPUT VALUE«CONTD .

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

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

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

HOW TO SET AN ACTION AS REUSABLE .

HOW TO CALL A REUSABLE ACTION Insert Call to existing Action .

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

USED TO VIEW THE VALUES OF THE PARAMETERS/VARIABLES DURING RUNTIME .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.

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

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 . W3 . WE [] ² TO INDICATE COLLECTION LIKE !W[E3] ² WE. CAN MATCH WELCOMES. WELCOMED * .MATCHES ANY NUMBER OF CHARACTER !W*-WHO. ² PERIOD MATCHES ONE CHARACTER !WELCOME.

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. TEST RUN . OBJECT PROPERTY CHANGE. APPLICATION CRASH.

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.

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

VALUE DIALOG(´Loginµ).SOME IMPORTANT FUNCTIONS SETTOPROPERTY SETTOPROPERTY() PROPERTYNAME.SETTOPR OPERTY(´Enabledµ.µTrueµ) .WinEdit(´Usernameµ).

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

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µ) .

RecordSetµ) B. Username = xxx.openµSelect * from table1µ.mdb.recordcount .CAN WE CONNECT DATABASE THROUGH QTP??? Answer is yes not through wizard but through scripting Set a = createobject(´ADODB.a Msgbox b.openµDSN = Employee.connectionµ) A. Password = xxxxµ Set b = createobject(´ADODB.

FileSystemObjectµ) Set b = a.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.readline 0 ² write mode 1.µtrueµ) Str = b.read mode 8 ² append True/false ² file exist or create new .0/1/8.opentextfile(´pathµ.

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µ).count .childobjects() Msgbox c.

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

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 .

RUN ´PATHµ FOR OPENING ANY APPLN INVOKE ´PATHµ FOR EXE APPLICATION EXECUTE ´PATHµ .IS IT POSSIBLE TO OPEN APPLICATION THROUGH SCRIPTING??? YES!!! SYSTEMUTIL.

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

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

FRAMEWORKS LINEAR FRAMEWORK ² RECORDING. PLAYBACK HERE U CREATE SCENARIOS. DO RECORDING BASED ON SCENARIOS. AND PLAYBACK FOR EXECUTION . ENHANCEMENT IS DONE FOR VERIFICATIONS. ENHANCEMENT .

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. DATA AND DESCRIPTION. VB SCRIPTS ARE AUTOMATICALLY GENERATED BY QTP . OPERATION.

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

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

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

Sign up to vote on this title
UsefulNot useful