QTP TUTORIAL WITH PPT

  • Published on
    10-Apr-2015

  • View
    3.306

  • Download
    3

Embed Size (px)

Transcript

<p>QTP 8.2QUICK TEST PROFESSIONAL 8.2</p> <p>1. Introduction 2. Recording a Session 3. Running a Session 4. Object Management 5. Synchronization 6. Check Points 7. Output Values 8. Parameterization 9. Actions 10. Recovery Scenario Manager 11. Debugging</p> <p>IntroductionMercury Quick Test Professional 8.2 provides the industrys best solution for functional test and regression test automation - addressing every major software application and environment.</p> <p>Why QTP</p> <p>Ease of use: 1. QTP allows even novice testers to be productive in minutes. You can create a test script by simply pressing a Record button and using an application to perform a typical business process. 2. Using the Active Screen facility, several types of checkpoints for any object to verify that components behave as expected can be created simply by clicking on that object in the Active Screen. 3. Data Table, an integrated spreadsheet with the full functionality of Excel, is used to manipulate data sets and create multiple test iterations, without programming, to expand test case coverage. QuickTest Professional supports functional testing of all popular environments, including Windows, Web, .Net, Visual Basic, ActiveX, Java, SAP, Siebel, Oracle, PeopleSoft, terminal emulators, and Web services .</p> <p>AddAdd-in Manager</p> <p>Keyword View</p> <p>Expert View</p> <p>Create the Basic TestRecord user actions Save the test Verify successful playback</p> <p>Record User Actions</p> <p>Start recording on the Mercury Tours Web site. Choose Test &gt; Record or click the Record button. The Record and Run Settings dialog box</p> <p>In the Windows Applications tab, confirm that Record and run on these applications (opened on session start) is selected, and that there are no applications listed.</p> <p>This setting prevents you from inadvertently recording operations performed on various Windows applications (such as e-mail) during ea recording session. Click OK. OK.</p> <p>Recording Modes Normal: recognizes the objects in the application Normal: irrespective of their location in the screen. Analog: records the exact keyboard and mouse Analog: operations with respect to the screen coordinates or the application window. Low level: records any object irrespective of support level: from QTP. Recognizes all run time objects as windows objects. It is used when an object is not identified by Quick test.</p> <p>Save the Test </p> <p>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.</p> <p>Verify Successful Playback </p> <p>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 resultsor a temporary folder.</p> <p>Running a Session</p> <p>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. The Update Run option in the Test menu is used to update the Active screens, Checkpoints and the test object descriptions.</p> <p>Viewing the Test Results</p> <p>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).</p> <p>How QuickTest Works with Objects</p> <p>What are Object Properties? A set of characteristics that defines an objects appearance, values, state and identity in an application. 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.</p> <p>Object Repository</p> <p>What is Object Repository? Object Repository is a location within the test structure where QuickTest stores object information captured during recording. The Object Repository can be used to: Rename logical names for readability. Add a new object in the repository. Configure the object properties used to identify an object.</p> <p>Object RepositoryObject Name and Class</p> <p>Object List</p> <p>Object Properties</p> <p>Object RepositoryThe 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. frequently.</p> <p>Object Spy</p> <p>It can be used to view the properties and values of an object in any open application. Click the pointing hand to select the object in the application. The objects properties (Test object properties and Run-Time object properties) and Runmethods can be identified. The objects hierarchy tree is also displayed. To perform other events such as mouse clicks or window focus hold the CTRL key.</p> <p>Object Identification</p> <p>SynchronizationWHAT IS SYNCHRONIZATION ? Synchronization refers to adding a step in the script that instructs Quick Test to wait for a particular object before proceeding to the next step during playback. When do you need SYNCHRONIZATION ? When you observe that the application takes a longer time to process information sent or respond to a client request, add a synchronization step while recording. For example: - A progress bar to reach 100%. - A button to become enabled. - A window or pop-up message to open. pop-</p> <p>How to ADD Synchronization</p> <p>Synchronization can be added ONLY during recording. Identify the object to be synchronized. Navigate to the window where the object is located. Locate the step in the test that corresponds to the object. Start recording and add the synchronization point.</p> <p>Two ways to set Synchronization</p> <p>Global synchronization value for all Objects. Instructs Quick Test to wait for all the objects for a specific amount of time.</p> <p>Synchronization of a specific Object. Instructs Quick Test to wait for a specific object only.</p> <p>Global synchronization value for all Objects</p> <p>Menu Test Settings Run For every object in the test, Quick Test can wait a maximum number of milliseconds specified in the settings</p> <p>Synchronization of a Specific Object</p> <p>Menu Insert Step Synchronization Point Quick Test shall pause the test until the object property achieves the value specified here (or until the specific timeout amount is exceeded). Quick Test uses one of the objects properties as the waiting criteria. E.g. Text property for window, Label property for buttons etc.</p> <p>Checkpoints In QTP</p> <p>A checkpoint is a verification point that compares a current value for a specified property with the expected value for that property.</p> <p>Types Of Checkpoints Standard</p> <p>Checkpoint Bitmap checkpoint Text checkpoint Text Area checkpoint Database checkpoint XML Checkpoint</p> <p>Types and Their Use</p> <p>Standard Checkpoint</p> <p>Bitmap Checkpoint</p> <p>Checks the property value of the object in an application or Webpage. It checks buttons,Radiobuttons, Comboboxes etc Checks the value of an image in the application.</p> <p>Text Checkpoint</p> <p>Checks whether the text string is displayed in the appropriate place in your application or on a Web page</p> <p>Database Checkpoint</p> <p>Checks the contents of a database accessed by the application Checks the data content of XML documents in the application. application.</p> <p>XML Checkpoint</p> <p>When to Use Checkpointscreating checkpoints on web objects we have to select web-test weboption in ADD-IN Manager. ADD If the objects developed in HTML we can use Standard Check point. If the Objects developed in XML we can use XML Check point. Before</p> <p>How Checkpoints Work PlaybackScriptTest Results PASS</p> <p>Expected ResultActual = expect ed ?</p> <p>Execute checkpoint Object: Button Logical Name : OK Property: Enabled Value: True</p> <p>Sample Objects that QuickTest can VerifyWINDOWSWindow Edit Field Drop down list Menu command Radio Button Checkbox Windows Object Status Bar Text Area</p> <p>WEBBrowser Text Area Text Link Images Image Link Edit Field Drop down list Checkbox Radio Button Tables/ Grids Web Element</p> <p>How to Add a Checkpoint1. Select the object in the Active Screen 2. Right Click on it and Select Insert Standard Checkpoint or Menu Insert Checkpoint Standard Checkpoint</p> <p>How to Add a Checkpoint set expected value</p> <p> 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.</p> <p>Table Checkpoint</p> <p>Database Checkpoint</p> <p>Choose Insert &gt; Checkpoint &gt; Database Checkpoint. Checkpoint. The Database Query Wizard opens.</p> <p>Database Checkpoint ..contd</p> <p>How to Add a Checkpoint Test Result</p> <p>Output Values Output</p> <p>Value is used to retrieve the current value of any object in the application and stores it in a specified location.</p> <p>NavigationInsert Output Value Select the type of output value. Right click the object in the Active screen and select the type of output value to be added</p> <p>Types of Output Values</p> <p>Standard Output Values</p> <p>Text Output Values</p> <p>To output the property values of most objects like editbox,button,radi o button,list box,etc. To output text strings displayed in the application</p> <p>Text Area Output Values</p> <p>Database Output Values</p> <p>XML Output Values</p> <p>To output text strings displayed within a defined area of the application To output the contents of database cells, based on the results of a query on the database. To output the values of XML elements and attributes in XML documents</p> <p>How to use Output ValueSelect the output to be considered</p> <p>Select the Property</p> <p>How to use Output ValueContd.</p> <p>Output Value</p> <p>ParameterizationA</p> <p>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.</p> <p>Types of ParameterizationParameterization can be done in three ways using Quick Test. Datatable Environment variables Random numbers</p> <p>DataTable Parameters</p> <p>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</p> <p>Specify an option in the Datatable iterations frame.</p> <p>Environment variable Parameters</p> <p>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 UserClick New to create your own internal variables</p> <p>Random number Parameters It</p> <p>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.</p> <p>How to Parameterize an Input Value</p> <p> Select the step in the Tree View that contains the recorded input value. Click on the text under Value column.</p> <p>How to Parameterize an Input Value contd.-Select the source for paramterization. -Select the parameter name. -Select the data sheet to use.</p> <p>How to Parameterize an Input Valuecontd</p> <p>ActionsA</p> <p>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 action. 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.</p> <p>Each action has its own sheet in the Data Table so that we can insert data that applies only to that action.</p> <p>Actions can be of three types: Non-re-usable: Action can be used in the Non-relocal test, only once.</p> <p>Reusable: Action can be used in the local test, multiple times.</p> <p>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.</p> <p>Actions on Quick Test Window (Keyword View): Actions Tool Bar contains buttons and a list of actions, enabling us to view the details of an individual action or the entire test flow. The test flow displays the overall flow of the test with all the actions in the test.</p> <p>How to set an Action as Reusable</p> <p>How to Call a Reusable Action</p> <p>Insert Call to existing Action</p> <p>Recovery Scenario ManagerThe recovery scenario manager is used to : defining the trigger event that interrupts the run session specifying the recovery operation(s) required to continue choosing a post-recovery test run operation post specifying a name and description for the recovery scenario specifying whether to associate the recovery scenario to the current test and/or to all new tests.</p> <p>Components of a Recovery ScenarioThe event that interrupts the test run (e.g. a pop up screen or run error) The operation that needs to be performed in order to continue running the test.</p> <p>The instructions on how the test should proceed once the recovery operation is performed.</p> <p>Steps to add a Recovery Scenariocontd</p> <p>After clicking on HAND, select the message/ error window. The click on Next.</p> <p>Steps to add a Recovery Scenariocontd</p> <p>Steps to add a Recovery Scenariocontd</p> <p>After clicking on HAND, select the OK button in the Error/Message window.</p> <p>Steps to add a Recovery Scenariocontd</p> <p>Steps to add a Recovery Scenariocontd</p> <p>Give a name and description to the recovery scenario</p> <p>Steps to add a Recovery Scenariocontd</p> <p>Debugging</p> <p>The Pause option in the Debug menu is used to temporarily suspend the run. To resume running a paused test, click the Run button. The StepInto(F11) option in the Debug menu is StepInto(F11) used to run the current line of the test. If the current line of the active test or component calls another action or a function, the called action/function is displayed in the QuickTest window, and the test or component pauses at the first line of the called action/function. Step Out Choose Debug &gt; Step Out or click the Step Out button, or press SHIFT+F11 only after using Step Into to enter a action or a useruserdefined function. Step Out runs to the end of the called action or user-defined function, then userreturns to the calling action and pauses the run session.</p> <p>BreakpointThe Insert\Remove Breakpoint(F9) option in the Insert\ Breakpoint(F9) Debug menu is used to stop a test run at a prepredetermined place in a test. To set a breakpoint: 1 Click a step or a line in the test or component where you want the run to stop. 2 Choose Debug &gt; Insert/Remove Breakpoint, Breakpoint, press F9, or click the Insert/Remove Breakpoint button. The breakpoint symbol is displayed in the left...</p>