Day1: Intro to QTPWhat is QTP?Features of QTPObjectsQTP EnvironmentAdd-In architectureRecording for webRun and AnalyzeQTP ComponentsObject SpyObject Repository
What is QTP?Q uickT est P rofessional, popularlyknown by its acronym QTP is anautomation testing tool originallyfrom Mercury Interactive whichwas acquired by Hewlett Packard(HP) in 2006. QTP is primarilyused for functional and regressionautomated testing.
What is QTP?Using QTP, you can automate useractions on a web or client basedcomputer application and test the sameactions for different users, different dataset, on various Windows operatingsystems and/or different browsers.Automation using QTP if planned andexecuted in a proper manner can saveconsiderable time and money.
What is QTP?QTP is one of the most widelyused automation testing tools inthe market today with over 60%market share. Due to this reason,skilled QTP professionals arealways in demand.
Features of QTP1. A great set of new Quality Center 10.00 integration abilities are there in QuickTest Professional 10.0. Integration abilities such as:-You can maintain asset versioning and baselines.There is an Asset Comparison Tool for comparing versions of individual QTP assets.
Features of QTPIt also includes an Asset Viewer for viewing an earlier version of a QTP asset and much more such as tool to upgrade all QuickTest assets to use these new features etc.[QuickTest assets include tests, components, application areas, and the resources associated with them, such as shared object repositories, function libraries, recovery scenarios, and external data tables.]
Features of QTP2. You can use the File > Save Test with Resources command to save a standalone, local copy of your test with all associated resource files and any called actions. This perks up portability.
Features of QTP3. LoadAndRunAction statement helps you load and run an action only when the step runs so that these actions are not loaded each time you open a test.
Features of QTP4. You can centrally manage your work items and ToDo tasks in the To Do Pane, which enables you to create and control self- defined tasks, and to view a compiled set of the TODO comments from your tests, associated function libraries and components.
Features of QTP5. You can now develop your own algorithm to compare bitmap checkpoints. A custom comparer is an object that performs the bitmap comparison for the checkpoint according to your testing requirements. QuickTest then receives and reports the results that the custom comparer returns.
Features of QTP6. There are also some improvements in the Test Result Analysis e.g. QuickTest run results can now be exported to MS Word and PDF format, use of an image file as a fourth argument to Reporter.ReportEvent method, select jump to Step in QuickTest when you right click any node in test results to show that step within the QuickTest testing document, run results for tests and components that are run as part of a Quality Center test set now include the Quality Center server and project name etc.
Features of QTP7. The new Delphi Add-in enables you to test Win32 VCL Delphi controls.8. File > Settings > Local System Monitor enables you to monitor the local (clientside) computer resources used by the application instance you are testing during a run session.There are some feature enhancements also like:-You can upgrade from QTP 9.5 to QTP 10 without uninstalling QTP 9.5 first.IntelliSense functionality is improved.Design and functionality of a debugger pane is improved.Maintenance Run mode now includes new Object Identification Solutions.Added Control for Editing and Managing Actions in Automation Scripts.A new look for some dialog boxes.An improved Web Add-in Extensibility and much more.
Features of QTP8. File > Settings > Local System Monitor enables you to monitor the local (clientside) computer resources used by the application instance you are testing during a run session.
Features of QTPThere are some feature enhancements also like:-You can upgrade from QTP 9.5 to QTP 10 without uninstalling QTP 9.5 first.IntelliSense functionality is improved.Design and functionality of a debugger pane is improved.
Features of QTPMaintenance Run mode now includes new Object Identification Solutions.Added Control for Editing and Managing Actions in Automation Scripts.A new look for some dialog boxes.An improved Web Add-in Extensibility and much more.
Features of QTPXPath and CSS based object identificationGood Looking and Enhanced ResultsViewerEasy Regular ExpressionsNow identify objects not only in relation toeach other but in relation to neighboringobjects.Load Function Libraries at Run TimeTest Your GUI and UI-Less ApplicationFunctionality in One TestRecord SupportMuch Awaited Log Tracking is available
ObjectsObjects are GUI entities, qualified withsome properties, data and the methodsnecessary to operate on that data.Property describes the object defined,which differentiates the given object withother objects.Methods are functions, required in order tomanipulate the object properties.
ObjectsExample: A Button is said to be anobject which consists of propertiessuch as ‘Enabled’, ‘Size’ and methodssuch as ‘onClick’, ‘OnFocus’ etc.
ObjectsProperties - These are characteristicsof the object e.g. the text on a button.QTP uses this to recognize theobject.
ObjectsMethods - These are built infunctionality of the object. The VBScriptcode that we write (or record) actuallymakes calls to the methods of an objecte.g. Reporter.ReportEvent(). HereReportEvent is the method of theReporter object.
ObjectsEvents - These are what can bedone to an object. This is used byprogrammers to determine what anobject does in response to anaction you perform. It is howeverunused in QTP.
ObjectsQTP Object Identification ProcessObject Identification: The tool determines whatproperties of objects are recorded.Object Spy: Allows users to view the property ofan object without recording it.Object Repository: Holds information recordedabout each object allowing the test to identifythe object during execution.
ObjectsObject Smart IdentificationSmart Identification is not ArtificialIntelligenceSI uses loose/unreliable object recognitionIt’s recommended to disable SI for each andevery page/window/control using the Tools->Object Identification dialog (Recording)Another way to disable SI: File -> Settings-> Run -> Check the "Disable SmartIdentification during run session" check box(Run-Time)
Add-In architectureEnables QTP to provide support formultiple technologies.Add-ins are software that need to beinstalled on a system that has QTP.It then becomes integrated with theQTP environment.
Add-In architectureQTP is sold with the ability to understand afew technologies, add-ins provide QTP withthe ability to understand additionaltechnologies.Users are able to select the specific add-insfor the technologies they are testing therebyreducing the memoryfootprint of QTP
Add-In architectureWhen QTP is started, you should selectonly the add-ins for technologies that areused with your application.Some of the available add-ins areActiveX - For testing software written usingActiveX (also known as COM) technology.This technology allows people to createobjects in one language and use thoseobjects within other languages/applications.
Add-In architectureVisual Basic - For applications written in theVisual Basic language.Web - For testing web applications writtenin any language. In web applications, weinteract with the application though a webbrowser and so the web application can bewritten in any language.
Recording for webQTP Option SettingsTools>Options displays the optionsdialog box. Here the Web tab optionsdetermine QTPs behavior whenrecording and running tests orcomponents on Web sites.
Run and AnalyzeWhen you run your test, QuickTest opensthe appropriate application or Web site and performs each step as itwas originally recorded in the test. When QuickTest finishes running thetest, it displays the results of the run.
Run and AnalyzeRunning a TestStart QuickTest and open theRecording test.If QuickTest is not already open,choose Start > Programs >QuickTest Professional > QuickTestProfessional .
Run and AnalyzeIf the Welcome window opens,click Open Existing .If QuickTest opens without displayingthe Welcome window, chooseFile > Open or click the Open button.In the Open Test dialog box, locate andselect the Recording test, thenclick Open .
Run and AnalyzeAnalyzing Test ResultsWhen QuickTest finishes running the test, the Test Resultswindow opens.QuickTest Professional (QTP) gives an excellent feature toview the results summary and ability to drilldown to the levelof each object.By default after every execution test results window getsopened and we can see the Test Results Summary. Thiswindow shows the following:Name of the testTime zoneRun started timeRun end timeIterationStatus (Passed, Failed, Warnings)
Run and AnalyzeWhen the execution is initialized (by either clicking Run or pressing F5), a popup comes and shows two options as in the below figure.New run results folderTemporary results folderThe first option creates a new folder for every run where the second one will write the results into a temporary folder, which gets overwritten next time. Usually, if we want to store the results then select the first option otherwise if you are executing the test for debugging purpose select the second one. If you are executing the test multiple times for debugging purpose, then it is better to select the second option, otherwise the QTP unnecessarily creates too many results folders.
Run and AnalyzeFollow the below steps to arrive at the Test Results window:Open the test – InsertNewOrder(Click on Run or press F5)Select the second option / Temporary run results folderClick OKQTP executes the test and opens the Results window by default.If Results window does not open then Go to Automation menu –> click Results optionGo through the Test Results.
Run and AnalyzeAfter the execution of any test scenario, a test automation engineer needs to know whether all the steps are passed. If any test step is failed then we can find out the action (i.e. click, select, navigation, etc) in Test Results tree.
Run and AnalyzeClick the plus symbol (+) on the Test Results tree and drilldown to the level of object (i.e. button, edit box, dropdown, etc). For each action we can see the description such as Object, Time, Details, Result, etc.
Run and AnalyzeAnalyzing Test ResultsWhen QuickTest finishes running thetest, the Test Results window opens.
QTP ComponentsQTP (QuickTest Professional) lets you createtests and business components by recordingoperations as you perform them in yourapplication.Test - A compilation of steps organized into oneor more actions, which we can use to verify thatour application performs as expected. A test iscomposed of actions (3 kinds of actions arethere in QTP Non-reusable action, Reusableaction and External action).
QTP ComponentsFirst step is PlanningBefore starting to build a test, you shouldplan it and prepare the requiredinfrastructure.
QTP ComponentsFor example, determine the functionalityyou want to test, short tests that checkspecific functions of the application orcomplete site.Decide how you want to organize yourobject repositories.
QTP ComponentsSecond step in QTP is Creating Tests orComponentsWe can create a test or component bya) Either recording a session on your application orWeb site.As we navigate through the application or site,QuickTest graphically displays each step we performas a row in the Keyword View. The Documentationcolumn of the Keyword View also displays adescription of each step in easy to understandsentences. A step is something that causes or makesa change in your site or application, such as clickinga link or image, or submitting a data form.
QTP Componentsb) Build an object repository anduse these objects to add stepsmanually in the Keyword View orExpert View. We can then modifyyour test or component withspecial testing options and/or withprogramming statements.
QTP ComponentsThird step isInserting checkpoints into your test or component.A checkpoint is a verification point that compares arecent value for a specified property with theexpected value for that property. This enables youto identify whether the Web site or application isfunctioning correctly.
QTP ComponentsFourth step isBroaden the scope of your test or component byreplacing fixed values with parameters.To check how your application performs the sameoperations with different data you canparameterize your test or component.When you parameterize your test or component,QuickTest substitutes the fixed values in your testor component with parameters.Each run session that uses a different set ofparameterized data is called an iteration.
QTP ComponentsWe can also use output values to extract datafrom our test or component. An output value is avalue retrieved during the run session and enteredinto the Data Table or saved as a variable or aparameter. We can subsequently use this outputvalue as input data in your test or component.We can use many functional testing features ofQuickTest to improve your test or componentand/or add programming statements to achievemore complex testing goals.
QTP ComponentsFifth step is running the testAfter creating test or component, we run it.Run test or component to check the site orapplication.When we run the test or component, QuickTestconnects to your Web site or application andperforms each operation in a test or component,checking any text strings, objects, or tables youspecified. If we parameterized the test with DataTable parameters, QuickTest repeats the test (orspecific actions in your test) for each set of datavalues we defined.Run the test or component to debug it.
QTP ComponentsWe can control the run session to identify andeliminate defects in the test or component. Wecan use the Step Into, Step Over, And Step Outcommands to run a test or component step bystep.We can also set breakpoints to pause the test orcomponent at pre-determined points.We can view the value of variables in the test orcomponent each time it stops at a breakpoint inthe Debug Viewer.
QTP ComponentsSixth step is analyzing the resultsAfter we run test or component, we can view the results.View the results in the Results window.After running the test or component, we can view theresults of the run in the Test Results window. We can viewa summary of the results as well as a detailed report.Report defects identified during a run session.If Quality Center is installed, we can report the defectsfond out to a database.We can instruct QuickTest to automatically report eachfailed step in the test or component, or we can report themmanually from the Test Results window.
Object SpyObject Spy Enhancements in 10.0:1. Object spy to have an option to exportall the objects in hierarchy with theirproperties and methods to a XLS / XMLfile. And also to have an option to reloadthis offline. This feature would help forothers to analyze a object recognitionremotely.
Object Spy2. Object spy to have the ability to runwithout QTP. Currently object spy can onlybe loaded through QTP.3. Object spy to have an option to disablethe Auto spy. Currently hovering on anyobject displays it properties without theneed to click the object. This at time givespoor performance while spying objects.
Object Spy4. Currently Object Spy button getsdisabled when the script is run, one has tolaunch object repository and then launchObject Spy fromthere. The Object Spy should enabledirectly when the script is run.5. Object Spy Automation capability, soother tools can leverage the same andautomate the OR creation based oncustom rules.
Object Spy6. Object spy to have capability to spy ondynamically created objects. E.g. – Thesearch suggestion box on Google.7. Object Spy to have facility to comparetwo different objects and show thedifferences.8. Object Spy to support XPaths foridentifying objects.
Object SpyQTP 11 Object Spy has been improvednow with following features:Add an object to a repository.Highlight an object in your application.Copy/paste object properties.Add an object to a repository.You can now add an object to the objectrepository directly from the Object Spy.
Object SpyHighlight an object in your application.When you select a test object in the ObjectSpy Object hierarchy tree, you can thenselect to highlight the object in yourapplication that corresponds to that testobject.
Object SpyCopy/paste object properties. You can copy theidentification properties and values of a selectedtest object in the Object Spy and paste thedetails into any document. The details areformatted in programmatic description syntax.This option is especially useful if you want tocompare the properties and values of twoobjects in your application or when creatingprogrammatic descriptions.
Object RepositoryObject Repository is a placewhere QTP stores learnedobjects.QTP uses default ObjectIdentification properties:mandatory and assistive tolearn objects into OR.
Object RepositoryCreating an Object RepositoryPer Action: An object repository is createdfor each action.This means that multiple objectrepositories can be created per test.Shared: A single objected repository isused for multiple tests.
Object RepositoryWhat is Object Repository in QTP?Object repository in QTP:Object repository is the heart of QTP, if youdon’t understand it properly than you will facelots of problems in developing and testing ofyour application.Please keep in mind following points regardingobject repository:- Test objects can be saved in two types ofobject repositoryLocal object repository and Shared objectrepository
Object Repository- A local object repository storesobjects in a file that is associatedwith one specific action, so that onlythat action can access the storedobjects- A shared object repository storestest objects in a file that can beaccessed by multiple tests.
Object Repository- When you want to create test (Newproject) you have two ways to store theobjects in your test.- Store the objects in corresponding localobject repository OR- Store the objects in one or more Sharedobject repository. (Smart ,advanced andefficient way) because it reducesmaintenance and enhance reusability ofyour tests.
Object RepositoryScript playback using ORQTP finds the Object in Object Repositoryusing object Logical Name and ObjectHierarchy.QTP retrieves Test Object properties fromOR.QTP searches actual application for theObject with the same properties as the ORTest Object and performs user action.
Object RepositoryTO, RO and .Object.GetTOproperty/SetToProperty refers tothe properties stored in OR.GetROProperty property refers to theAUT Object property (Run-time).Object.<property/method> refers to theAUT Object NATIVE properties/methods
Object RepositoryPROS:GUI Front end to examine all the objectsin the repository.Highlight in Application feature is greattool to walk the object tree.No need to modify the script when objectproperties changes.Easy to identify objects in AUT by ObjectLogical names.Can be created independently fromscripts.
Object RepositoryCONS:Additional layer to maintainUnnecessary objects can becreated.Multiple users cannot concurrentlysave / write to the shared OR.It won’t eliminate the need forDescriptive Programming in mostof cases.
QTP Continued Day2:QTP FeaturesSynchronization pointsModes of RecordingCheckpoints
QTP Continued Day3:Advanced FeaturesParameterizationStep GeneratorAdding conditional statementsCustom checkPoints
QTP Continued Day4:Advanced FeaturesReport and CommentSplitting ActionVirtual object
QTP Continued Day5:Advanced QTPRecovery scenarioOptional stepsFramework ApproachWorking with Dynamic Objects
A particular slide catching your eye?
Clipping is a handy way to collect important slides you want to go back to later.