Concepts in QTP

  • Published on

  • View

  • Download

Embed Size (px)


<p>Concepts in QTPQTP- QuickTest Professional QTP Testing Process Test Object Model QTP Object Repositories (Covered in Tutorial 21) Descriptive Programming in QTP (Covered in Tutorial 21) CheckPoints in QTP (Tutorial 4-10) QTP Recordings QTP Parameterize Tests QTP Keyword View Actions in QTP</p> <p>QTP Quick Test ProfessionalQTP (QuickTest Professional) is Mercury's advanced keyword-driven testing solution. QTP (provides for functional test and regression test automation. With QTP you will be able to test Standard Windows applications , Web objects, ActiveX controls, and.Net ,Java , SAP (Systeme, Anwendungen und Produkte in der Datenverarbeitung, Systems, Applications and Products in Data Processing) Visual Basic applications. Siebel , Oracle , PeopleSoft and Terminal emulators ( We need additional QuickTest add-ins for special environments e.g. .Net, Terminal emulators. The current version of QTP (version 9.x) supports running tests on the following browsers: Microsoft Internet Explorer 6.0 Service Pack 1 or 7.0 Beta 2 and lower Netscape Browser 8.0 Mozilla FireFox 1.5. QuickTest Professional 9.2 is compatible with: SAP 8.2, .NET 9.2, Web Services 9.2, Java 9.1, Oracle 8.2, PeopleSoft 8.2, Siebel 8.0, Stingray 8.2, Terminal Emulator 8.0, and VisualAge Smalltalk 8.2.</p> <p>QTP (QuickTest Professional) is Unicode compliant according to the requirements of the Unicode standard, enabling you to test applications in many international languages. As and when an application under test changes, such as when a "Log in" button is renamed "Sign Into," we can make one update to an XML-based Shared Object Repository (within the new Object Repository Manager), and the update will circulate (propagate) to all tests that reference this object. QuickTest Professional keeps object-level changes synchronized among users throughout test creation efforts. Moreover, now users can invoke and run Mercury WinRunner scripts and functions from Mercury QuickTest Professional, and then automatically report WinRunner results back into the original scripts.</p> <p>QTP Testing ProcessQTP (QuickTest Professional) lets you create tests and business components by recording operations as you perform them in your application. Test - A compilation of steps organized into one or more actions, which we can use to verify that our application performs as expected. A test is composed of actions (3 kinds of actions are there in QTP Non-reusable action, Reusable action and External action). First step is Planning Before starting to build a test, you should plan it and prepare the required infrastructure. For example, determine the functionality you want to test, short tests that check specific functions of the application or complete site. Decide how you want to organize your object repositories. Second step in QTP is Creating Tests or Components We can create a test or component by a) Either recording a session on your application or Web site. As we navigate through the application or site, QuickTest graphically displays each step we perform as a row in the Keyword View. The Documentation column of the Keyword View also displays a description of each step in easy-to-understand sentences. A step is something that causes or makes a change in your site or application, such as clicking a link or image, or submitting a data form. OR b) Build an object repository and use these objects to add steps manually in the Keyword View or Expert View. We can then modify your test or component with special testing options and/or with programming statements.</p> <p>3)Third step is Inserting checkpoints into your test or component. A checkpoint is a verification point that compares a recent value for a specified property with the expected value for that property. This enables you to identify whether the Web site or application is functioning correctly. 4) Fourth step is Broaden the scope of your test or component by replacing fixed values with parameters. To check how your application performs the same operations with different data you can parameterize your test or component. When you parameterize your test or component, QuickTest substitutes the fixed values in your test or component with parameters Each run session that uses a different set of parameterized data is called an iteration. We can also use output values to extract data from our test or component. An output value is a value retrieved during the run session and entered into the Data Table or saved as a variable or a parameter. We can subsequently use this output value as input data in your test or component. We can use many functional testing features of QuickTest to improve your test or component and/or add programming statements to achieve more complex testing goals. 5) Fifth step is running the test After creating test or component, we run it. Run test or component to check the site or application. When we run the test or component, QuickTest connects to your Web site or application and performs each operation in a test or component, checking any text strings, objects, or tables you specified. If we parameterized the test with Data Table parameters, QuickTest repeats the test (or specific actions in your test) for each set of data values we defined. Run the test or component to debug it. We can control the run session to identify and eliminate defects in the test or component. We can use the Step Into ,Step Over And Step Out commands to run a test or component step by step. We can also set breakpoints to pause the test or component at pre-determined points.</p> <p>We can view the value of variables in the test or component each time it stops at a breakpoint in the Debug Viewer. 6) Sixth step is analyzing the results After 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 the results of the run in the Test Results window. We can view a 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 defects fond out to a database. We can instruct QuickTest to automatically report each failed step in the test or component, or we can report them manually from the Test Results window.</p> <p>Test Object ModelTest object Model is a set of object types or Classes that QuickTest uses to represents the objects in our application. A test object class comprises of a list of properties that can individually (uniquely) identify objects of that class and a set of appropriate methods that QuickTest can record for it. Test Object Class A test object is an object that QuickTest creates in the test to correspond to (represent) the actual object in the application. QuickTest uses the stored information about the object during the run session to identify and check the object. A run-time object is the real (actual) object in the application or Web site on which methods are performed during the run session. Properties and methods of objects: The property set for each test object is created and maintained by QuickTest. The property set for each run-time object is created and maintained by the object architect (creator) (Microsoft for Internet Explorer objects, Netscape for Netscape objects). Similarly, methods of test objects are methods that QuickTest recognizes and records when they are executed (performed) on an object while we are recording, and that QuickTest executes when the test or component runs. Methods of Run-time object are the methods of the object in the application as defined by the object architect (creator). We can access and execute run-time object methods using the Object property. Some important points to remember about methods and properties :</p> <p>Each test object method we execute (perform) while recording is recorded as a separate step in the test. When we run the test, QuickTest executes (performs) the recorded test object method on the run-time object. Properties of test object are captured from object while recording. QuickTest uses the values of these properties to identify runtime objects in the application during a run session. Property values of objects in the application may change .To make the test object property values match the property values of the run-time object, we can modify test object properties manually while designing the test or component or using SetTOProperty statements during a run session. We can also use regular expressions to identify property values. We can view or modify the test object property values that are stored with the test or component in the Object Properties or Object Repository dialog box. We can view the syntax of the test object methods as well as the run-time methods of any object on our desktop using the Methods tab of the Object Spy. We can retrieve or modify property values of the TEST OBJECT during the run session by adding GetTOProperty and SetTOProperty statements in the Keyword View or Expert View. We can retrieve property values of the RUNTIME OBJECT during the run session by adding GetROProperty statements..</p> <p>If the available test object methods or properties for an object are not sufficient or they do not provide the functionality we need, we can access the internal methods and properties of any run-time object using the Object property. We can also use the attribute object property to identify Web objects in the application according to user-defined properties.</p> <p>QTP Object Repositories(Covered in Tutorial 21)</p> <p>Descriptive Programming in QTP(Covered in Tutorial 21)</p> <p>CheckPoints in QTP(Covered in Tutorials 4-10)</p> <p>QTP RecordingsThe default mode of recording is the Normal recording mode. There are other</p> <p>recording modes also like Analog Recording or Low Level Recording. Normal mode is the default and takes full advantage of the QuickTest test object model, as it recognizes the objects in the application regardless of their location on the screen. Analog Recording : Exact mouse and keyboard operations are recorded in relation to either the screen or the application window. In this QTP also records and tracks every movement of the mouse for example, recording a signature produced by dragging the mouse. Analog Recording steps are not editable from within QuickTest. Low Level Recording: At any time, if an environment or on an object not recognized by QuickTest, use Low Level Recording. It records at object level and records all run-time objects as Window or WinObject test objects. QuickTest records all parent level objects as Window test objects and all other objects as WinObject test objects. Each step recorded in Low Level Recording mode is shown in the Keyword View and Expert View. All the three modes of recording can be used in a single test e.g. we can switch to either Analog Recording or Low Level Recording in the middle of a recording session for specific steps and then return to normal recording mode. Analog Recording and Low Level Recording require more disk space than normal recording mode. Use Analog Recording when : The actual movement of the mouse is what you want to record. Recording in Analog mode can be relative to the screen or relative to a specific window (see user guide for detail) In Analog Recording a separate file is saved and stored with the action. In Analog Recording mode, QuickTest adds to your test a RunAnalog statement that calls the recorded analog file. Use Low Level Recording when : Environments or objects not supported by QuickTest. Exact location of the operation on your application screen is necessary. in normal mode QuickTest performs the step on an object even if it has moved to a new location on the screen. If the location of the object is important to your test, switch to Low Level Recording</p> <p>QTP Parameterize Tests</p> <p>By replacing fixed values with parameters QuickTest enables you to enlarge the scope of a basic test. It is known as parameterization, 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 parameterize. Parameters let us check how the application performs the same operations with multiple sets of data. There are four types of parameters Test/action parameters: Test parameters make possible for us to use values passed from the test. Action parameters enable us to pass values from other actions in your test. To use a value within a specific action, the value must be passed down through the action hierarchy of the test to the required action. We can then use that parameter value to parameterize a step in the test. For example, suppose that we want to parameterize a step in Action3 using a value that is passed into the test from the external application that runs (calls) the test. We can pass the value from the test level to Action1 (atop-level action) to Action3 (a nested action of Action1), and then parameterize the required step using this action input parameter value (that was passed through from the external application). Alternatively, we can pass an output action parameter value from an action step to a later sibling action at the same hierarchical level. For example, suppose that Action2, Action3, and Action4 are sibling actions at the same hierarchical level, and that these are all nested actions of Action1. We can parameterize a call to Action4 based on an output value retrieved from Action2 or Action3. We can then use these parameters in the action step. Data Table parameters 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. Environment variable parameters allow us to use variable values from other sources during the run session. These may be values that we supply, or values that QuickTest generates for us based on conditions and options we choose. Random number parameters Enable us to insert random numbers as values in your test. Values in steps and checkpoints can be parameterized while recording or editing the test. The values of object properties can be parameterized for a selected step. The values of the operation (method or function arguments) defined for the step can also be parameterized. When the value of an object property for a local object is parameterized, we are amending the test object description in the local object repository. Therefore, all occurrences of the specified object within the action are parameterized. Parameterizing the value of a checkpoint property enables us to check how an application or Web site performs the same operation based on different data.</p> <p>QTP Keyword ViewIn QTP we first of all record a test, then run a test and then analyze the results, but before running the test we can also enhance it with checkpoints and parameters. First of all...</p>