An insight to learn hp quicktest professional 10 0 by quontra solutions

Page 1

An Insight to Learn HP QuickTest Professional 10.0

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Topics Covered ♠ Object Repository Type and Object Recognition ♠ Shared Object Repository ♠ Checkpoints ♠ Transactions and Step Generators ♠ Exception Handling and Recovery Scenarios ♠ Analysis of Test Results

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Object Repository Type and Object Recognition

What is an Object Repository ?

Object Repository is a collection of objects pertaining to the application under test. Example: All the text boxes, list boxes, images etc are stored in a file in QTP. This file is called the object repository. Each object will have the set of properties to identify that object uniquely in the application. At the time of execution, QTP identifies the objects on the screen by comparing them with the objects and their properties in the repository.

We can have any number of Shared Object Repositories associated with an action. In QTP 10.0 all the objects are recorded into the local repository and then we need to export the objects from local repository into the shared object repository by opening the object repository and selecting File Menu and selecting "Export Local Objects". We need to specify the name for the shared object repository in which we want to save these objects.

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Object Repository Type and Object Recognition ♥ Object Identification ♥ Recording Modes: Context sensitive Mode Low-level Mode Analog Recording Mode

♥ Virtual Objects

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Object Repository Type and Object Recognition ♠ Types of Object Repository –

Per – action object repository

Shared object repository

♠ Per – action object repository ♥ Default repository

♥ Specific to actions (Will be used only for a particular action) ♥ Preferable when application is not dynamic with respect to time ♥ Cannot be reused

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Object Repository Type and Object Recognition ♠ Per – action object repository –

Default repository

Specific to actions (Will be used only for a particular action)

Preferable when application is not dynamic with respect to time

Cannot be reused

Example Action1 and Action 2 of same test will have different object repositories.

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Object Repository Type and Object Recognition ♠ Shared Object Repository –

Can be updated by all actions accessing it

Preferable when application is dynamic with respect to time

Used in most automation projects

Needs maintenance and administration

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Object Repository Type and Object Recognition Shared object repository may be common to all tests and to all actions inside each test

Shared object repository Test1

Action1

Action2

Test2

Action3

Action1

Action2

Test3

Action3

Action1

Action2

Action3

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Object Repository Type and Object Recognition What is Object Identification? Object identification is a method of instructing QTP to recognize the various objects in the application. Usually QTP can identify the objects uniquely for most of the applications/objects, but for some applications this may not be true. In this scenario we need to tweak the Object Identification settings of QTP to learn extra properties or custom properties defined in the application, for recognizing the objects uniquely.

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Object Repository Type and Object Recognition How to do Object Identification in QTP? Go to - Tools - Object identification - and select the environment (windows, web etc). This will give you all the possible type of objects in that environment like Edit boxes, check boxes etc. Select the type of object you have problem recognizing uniquely. QTP will show you the mandatory and assistive properties which are grabbed and used currently for that object. You can select the extra properties which are already defined in the application for that kind of object by clicking on the green "+" sign and selecting the required properties. If you still have the problem of recognition then you need to find out the unique property defined for that object type from the development team and Add that custom property by clicking "New" in the Add/Remove properties window of Object identification.

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Object Repository Type and Object Recognition How to do Object Identification in QTP? If you still have the problem of recognition then you need to find out the unique property defined for that object type from the development team and Add that custom property by clicking "New" in the Add/Remove properties window of Object identification. For example if the custom property name is "RefGen", you can click "New" and give the new property name as "attribute/RefGen". When you record next time on that kind of object the new properties will be automatically grabbed. If you want to update the existing objects run the test in the Update Run mode and select the checkbox Update Object Properties. Note: The changes you make in the Object Identification will affect everyone working on that machine. These changes should be applied universally on all the machines you intend to run the regression tests. These are QTP setting changes not the script changes.

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Object Repository Type and Object Recognition Object Identification

User can specify properties to be used for identification to distinguish between 2 - objects of same class object.

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Object Repository Type and Object Recognition Configuring Mandatory and Assistive Recording Properties: ♼ Mandatory properties:

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Object Repository Type and Object Recognition Mandatory properties: ♼ QTP has list of mandatory properties, for each type of object, which it always learns. ♼ When we run the script QTP uses all the mandatory properties to identify the object. It uses assistive properties when mandatory properties are not enough to identify an object.

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Object Repository Type and Object Recognition ♼ We can change the mandatory properties or assistive properties based on the application. ♼ We can add /remove few properties in mandatory properties or assistive properties so that QTP identifies the object when we run the script

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Object Repository Type and Object Recognition ♠ How to change properties of objects? ♥ Tools  Object Identification ♥ Object Identification dialog box opens ♥ Select the properties you want to make mandatory or assistive by selecting the option

Options are available to the user

Selected properties will be made mandatory in this case

Selection of properties should be based on nature of application Same is applicable to assistive properties

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Object Repository Type and Object Recognition Recording

Recording a link‌

Example‌ Mandatory Properties: Html tag:

A

Text:

Testing

Inner Text:

Testing

Coordinate X:

256

During recording QTP has stored both the mandatory as well as assistive properties for identifying the particular link.

Coordinate Y:

298

Let us check why?

Assistive Properties:

URL: Color:

Green

Font:

Arial

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Object Repository Type and Object Recognition Mandatory Properties: Html tag:

A

Text:

Testing

Inner Text:

Testing

Assistive Properties: Coordinate X: 234

During Recording Now QTP is able to identify the link with captured 3 Mandatory properties and 5 Assistive properties!! Starts using assistive properties and checks object Includes 1st Property

Includes 2nd Property Coordinate Y: 286 URL: www.abcd.com Includes 3rd Property

Color:

Orange

Font:

Arial

4th

5th

QTP uses Assistive properties if the stored Mandatory properties are not enough to identify an object

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Object Repository Type and Object Recognition Selecting an Ordinal Identifier: ♼ In addition to mandatory properties and assistive properties, QTP records backup ordinal identifier for each test object ♼ Used when QTP is not able to identify an object with captured mandatory properties and assistive properties during recording, In other words, Ordinal identifier is used if mandatory properties and assistive properties captured by QTP is insufficient to identify an object in the application during record session.

During a Record Session If mandatory properties and assistive properties are insufficient to identify an object during record session

QTP uses Ordinal Identifier in addition to other captured properties to identify the objects during a record session

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Object Repository Type and Object Recognition Types of Ordinal identifiers: ♥ Index based ♥ Location based ♥ Creation Time

Index: Indicates the order in which the object appears in the application code relative to other objects. Eg., pressing a tab and giving numbers to objects

Location: Indicates the order in which the object appears within the parent window, frame, or dialog box relative to other objects with an otherwise identical description

CreationTime (Browser object only): Indicates the order in which the browser was opened relative to other open browsers with an otherwise identical description. An ordinal identifier is selected by default for each test object class. To modify the selected ordinal identifier, select the desired type from the Ordinal identifier box.

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Object Repository Type and Object Recognition Setting up which ordinal identifier to use during object identification: ♼ User can select which ordinal identifier to be used by selecting the options in object identification ♼ The ordinal identifier in web will have three options namely Index, Location and Creation time. This Creation Time is not available in the ordinal identifier options of other environments.

Options for Web

Options for other Environments

Identifying an Object Using the Index Property: QuickTest can assign a value to the Index test object property of an object The value is based on the order in which the object appears within the source code. The first occurrence is 0.

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Object Repository Type and Object Recognition Identifying an Object Using the Location Property: ♥ During recording, QuickTest can assign a value to the Location test object property of an object in order to uniquely identify the object. ♥ The value is based on the order in which the object appears within the window, frame, or dialog box, in relation to other objects with the same properties. First occurrence value = 0 ♥ Values are assigned in columns from top to bottom, and left to right.

Example: Numbered based on location property

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Object Repository Type and Object Recognition Identifying an Object Using the CreationTime Property : ♥ During recording, QuickTest is unable to uniquely identify a browser object based solely on its test object description, it assigns a value to the CreationTime test object property. ♥ This value indicates the order in which the browser was opened relative to other open browsers with an otherwise identical description. ♥ During the run session, if QuickTest is unable to identify a browser object based solely on its test object description, it examines the order in which the browsers were opened, and then uses the CreationTime property to identify the correct one. Opening a new Opening a new browser with an browser with Example application same application QTP notes the creation time of both browsers as creation time property

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Object Repository Type and Object Recognition Configuring Smart Identification: ♥ Configuring Smart Identification properties enables you to help QuickTest identify objects in your application, even if some of the properties in the object's recorded description have changed.

About Configuring Smart Identification: ♥ QTP uses object description for identifying an object. If its not able to identify the object with the description, then it goes for smart identification mechanism. ♥ Smart identification uses two types of properties and are base filter properties and optional filter properties

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Object Repository Type and Object Recognition Base Filter Properties: ♼ Most fundamental properties of object class or values which cannot be changed without changing the essence of the original object. Eg., if a Web link's tag was changed from <A> to any other value, you could no longer call it the same object.

Optional Properties: ♼ Other properties to identify objects for a particular class as they are unlikely to change on regular basis, but can be ignored if they are not applicable.

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Object Repository Type and Object Recognition Step-by-step Instructions for Configuring a Smart Identification Definition: ♥ Tools > Object Identification. The Object Identification dialog box opens. ♥ Select the appropriate environment in the Environment list. The test object classes associated with the selected environment are displayed in the Test object classes list. ♥ Select the test object class you want to configure. ♥ Click the Configure button next to the Enable Smart Identification check box. The Configure button is enabled only when the Enable Smart Identification option is selected. ♥ The Smart Identification Properties dialog box opens:

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Object Repository Type and Object Recognition Base filters & Optional filters: ♥ In the Base Filter Properties list, click Add/Remove. ♥ The Add/Remove Properties dialog box for base filter properties opens. ♥ Select the properties you want to include in the Base Filter Properties list and/or clear the properties you want to remove from the list.

 Click OK to close the Add / Remove Properties dialog box. The updated set of base filte properties is displayed in the Base Filter Properties list.  In the Optional Filter Properties list, click Add/Remove. The Add/Remove Properties dialog box for optional filter properties opens. Same applies for optional properties also.  Use the up and down arrows to set your preferred order for the optional filter properties. >>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Object Repository Type and Object Recognition Recording Modes – Context sensitive, Low-level and Analog Recording Context sensitive: ♥ This is the Default mode of recording which takes full advantage of QuickTest's test object model. ♥ Records the objects in your application and the operations performed on them. ♥ Recognizes objects in application regardless of their location on the screen.

Analog Recording: ♥ Records the exact mouse and keyboard operations you perform in relation to either the screen or the application window. ♥ QTP’s Analog recording is captured as Tracks and stored in the directory of your test ♥ Useful for recording operations that cannot be recorded at the level of an object. Eg., A signature produced by dragging the mouse in a paint will be recorded in analog recording MS Paint

If recorded using Context sensitive mode, You will not get any drawing during playback

MS Paint

If recorded using Analog mode, You will be replay it back successfully

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Object Repository Type and Object Recognition Recording Modes – Context sensitive, Low-level and Analog Recording

Low Level Recording: ♥ Enables you to record on any object in your application, whether or not QuickTest recognizes the specific object or the specific operation. ♥ Records at the object level and records all run-time objects as Window or WinObject test objects. ♥ Used when the exact coordinates of the object are important for your tests. ♥ Used when recording tests in an environment (or on an object) not recognized by QuickTest.

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Object Repository Type and Object Recognition Virtual Objects: ♥ Substitutes for standard objects ♥ Used when standard objects cannot be recorded due to problems that arise during recording ♥ Virtual objects cover the regions in the application that QTP has failed to identify.

Scenario: ♥ During recording, QTP can fail to identify certain objects in the application screen. We will not be able to proceed on with recording the remaining part of the script without the line. ♥ Create virtual objects and start recording. That particular part of application will be covered and marked as virtual object in the script. ♥ By creating virtual objects, user can avoid scenarios which may stop automation of a test scenario. E.g.., Try creating a cell in excel sheet as Virtual Object and try recording it and check the script The following example clicks the "button" VirtualButton. Syntax: Browser(“X").Page(“Y").ActiveX(“Z").VirtualObject(“A").Click

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Object Repository Type and Object Recognition Defining a Virtual Object: ♼ Click Tools > Virtual Object > New Virtual Object ♼ You will get the steps as mentioned below

Click Next

Class can be Object, Button, Table, List, Check box & Radio button. Mark a class based on the object which is present in his application Eg., Mark radio button from the drop down shown if QTP has failed to identify a radio button in the application during recording a script

Next page for next step

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Object Repository Type and Object Recognition Step3 Step4 Click Mark Object button (The QTP screen is minimized) You will get a cross hairs pointer Use the cross hairs pointer to mark the object in application

You can select entire parent hierarchy or parent only

Step6

Step5

Add virtual object to a collection

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Shared Object Repository

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Shared Object Repository

Shared object repository Test1 Action1

Action2

Test2 Action3

Action1

Action2

Test3 Action3

Action1

Action2

Action3

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Shared Object Repository Same object repository for related functionalities across different actions or scripts It is also possible to add new objects to the existing repository either manually or while recording We can also specify additional properties for objects other than mandatory ones that appear when the objects are captured. Reusability of objects Changes in object properties can be updated directly in the shared object repository model

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Shared Object Repository Implementing Shared Object Repository: The object repository can be managed using a folder containing all the object repositories which have been used throughout the project. Files under this which contain object repositories (which are stored as .tsr files) are stored module wise.

Inserting Shared Object Repositories: There are two ways of adding shared object repositories to a test script 1) At design time 2) At run - time Same object repository for related functionalities across different actions or scripts

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Shared Object Repository Steps to add a shared object repository :  Open the Quick Test script. Go to Test  Settings in the menu bar. Select the “Resources” tab in the Test Settings window.  Click on the Shared radio button under Object repository type frame.  Enter the path of the shared object repository in the text box given in the Object repository type frame. Click on Apply button and then click on the OK button.  Now all the actions in this particular script can use the objects present in the added shared object repository.

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Shared Object Repository VB Script for creating shared object repository at run-time Option Explicit On error resume next Dim newApp Dim newObjRepository

'As newApplication declare the Application object variable 'As newObjectRepository 'Declare a Repository Object Variable

Dim strObj_Path

' To Set the Shared Object Repository Path ' Open QuickTest and prepare objects variables Set newApp = CreateObject("QuickTest.Application") newApp.Launch newApp.Visible = True

'Create the Application object

‘Start QuickTest 'Make the QuickTest application visible

Set newObjRepository = newApp.Test.Settings.Resources strObj_Path = <path of the object repository> newObjRepository.ObjectRepositoryPath = strObj_Path

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Shared Object Repository Releasing Objects When we add object repositories to a test script during run – time, a particular memory space is allocated to each of the object. We release this memory space at the end of each action to enhance the performance of the script. The extract given below is included at the end of each action to release the objects. Set newApp = Nothing ‘Release the Application object Set newObjRepository = Nothing 'Release the object repository object

Regular Expressions Regular Expression is similar to the usage of wild card characters in search functionalities.

Steps to use regular expression: 1. Go to Tools  Object repository in a Quick Test script. 2. Select the Object property of the object that needs to be regularised. 3. Click on the button highlighted in the snapshot given in next page 4. Open the Quick Test script. Go to Test  Settings in the menu bar. 5. Select the “Resources” tab in the Test Settings window. 6. Click on the Shared radio button under Object repository type frame. 7. In the Confirmation window that appears, Click on the No button to use “.*” as a regular expression and not as characters. 8. Click on OK button in the Constant Value Options.

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Shared Object Repository There are other types of regular expressions that can be used apart from “.*�, such as \ , %, etc. Shared object repository needs Object Repository Manager for managing all the object repositories. The basic function of an ORM is to take back up of the object repositories from time to time to prevent object repositories from becoming corrupt.

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Check Points

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Check Points What is a Checkpoint? A confirmation or verification point in which the value of some property which is expected at a particular step is compared with the actual value which is displayed in the application is called a Checkpoint.

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Check Points The expected value can be property of an image or web page or a table with values displayed in application, portion of text or text displayed in a specified region, a dynamic value displayed in application from database, bitmap of image displayed or dynamic text displayed from XML.

Check points are Classified as under:  Standard Checkpoint  Page Checkpoint  Text / Text Area Checkpoint  Image Checkpoint  Database Checkpoint  XML Checkpoint  Bitmap Checkpoint  Table Checkpoint  Accessibility Checkpoint

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Check Points Standard Checkpoint: Standard Checkpoint checks for property value of object displayed in any application. Object can be radio button, combo boxes, drop downs, button, images and links. A user who records a standard check point can select the properties of any property he wishes to check. QTP will check only the fields specified by the user. The value column is stored as expected result and can be modified or parameterised when creating and modifying checkpoint.

Expected result

If the value in the application is displayed as a table then this check point is called as Table Checkpoint. User can select few values in the table or select all the values as expected value. User also has options to parameterize the values.

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Check Points Page Checkpoint: A Standard Checkpoint created for a web page can be called a Page Checkpoint. Page Checkpoint includes checking Load time, number of images or links in a web page, checking every links and images, HTML Source and Tags verification and checking for broken lines.

Load time: The time taken by a web page to load. A user who uses this check point can give approximate amount of time that will be required for the page to load so that QTP will fail this checkpoint when page takes more time to load than specified. Number of links and images present in a web page Consider this a web page

Process Assets Process DB Reports Prospective Business Module Project Budgeting System Project Setup Proposal Information System

Order

QTP Results: No of Links: 6 No of Images: 4

Login Print Close

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Check Points Checking links and images: User can check all the links and images present in his application with the links and images expected with a page checkpoint. Checkpoint results will show the expected and actual result obtained as shown below.

HTML Source of a web page and broken lines in a web page can also be checked using a page check point

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Check Points Text/Text Area Checkpoint: Checks the text present in a web page or any application. We can store the expected text that should be present in the application when creating this checkpoint. QTP verifies whether the expected text with the actual text appearing and shows output as shown below.

Text Checkpoint can check for case sensitivity, space mismatches and for exact matches. These three options can be configured by the user as shown Expected result is shown in green color and actual content that captured in the web application is shown in red color. A text mismatch will be shown as represented above. Options will be provided to the user to export the contents to excel sheet in the same format

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Check Points Database Checkpoint: Compares the dynamic values displayed in the application with the values from the database. User will write a SQL query when creating this checkpoint with which QTP will check the dynamic values displayed in application.

Software Testing India

Query written in QTP to check random values: Select * from data where company = ‘Software Testing’;

Total number of Client : 10

Values retrieved from database by QTP

Application

Total number of employees: 2500 Total number in onsite : 200 Number in offshore

Cl_num

emp_num

on_num

off_num

10

2500

200

3200

: 3200

Dynamic values from database

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Check Points Database Checkpoint: Compares the dynamic values displayed in the application with the values from the database. User will write a SQL query when creating this checkpoint with which QTP will check the dynamic values displayed in application.

Software Testing India

Query written in QTP to check random values: Select * from data where company = ‘Software Testing Genius’;

Total number of Client : 10

Values retrieved from database by QTP

Application

Total number of employees: 2500 Total number in onsite : 200 Number in offshore

: 3200

7000

Cl_num

emp_num

on_num

off_num

10

2500

200

3200

700

Dynamic values from database

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Check Points XML Checkpoint: In web application, there will be several places for which data from XML will be displayed . QTP helps in comparing the values in the XML with the values displayed in application and also can validate the schema of XML.

 The contents displayed in a web application from XML is checked  Expected input values can be parameterized  XML Schema can also be validated with the checkpoint

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Check Points Bitmap Checkpoint: A Bitmap checkpoint helps a user in checking bitmap of an image or a full web page. Usually users should create record this checkpoint in prototype and will use the application for running. QTP will check whether the expected bitmap which is recorded previously exists in the application and provide us with appropriate results.

Mismatch! Bitmap Checkpoint Failed

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Check Points Accessibility Checkpoint: This checkpoint is specific to Web applications. World Wide Web Consortium (W3C) came up with some instructions and guidelines for Web-based technology and information systems. These guidelines should be strictly followed for all web application. When you insert Accessibility checkpoint using QTP for all pages in your application, it checks whether every page of the application follows the guidelines of W3C. Consumer can set his preferences for this checkpoint. We can instruct QTP for doing automatic accessibility checkpoint for every page we browse with the options provided.

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Transactions and Step Generators

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Transactions and Step Generators Transactions: Process in your application that you are interested in measuring. Include transactions to the section of your script to measure the time that is taken by your application to run those specified steps. Can be inserted anywhere in the script No limits to number of transactions you can create You can create a transaction within a transaction.

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Transactions and Step Generators Inserting Transactions A transaction is inserted by a method called startTransaction.

Syntax: Services.StartTransaction “Test_Transaction� Click the Start Transaction button opens.

or choose Insert > Start Transaction. The Start Transaction dialog box

Enter a meaningful name in the Name box.

Note: You cannot include spaces in a transaction name. Decide where you want the transaction timing to begin: To insert a transaction before the current step, select Before current step.

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<

To insert a transaction after the current step, select After current step.


Transactions and Step Generators Ending Transactions : A Transaction is ended using the method End Transaction.

Syntax Services.EndTransaction "Test_Transaction�

To end a transaction: Click the End Transaction button

or choose Insert > End Transaction.

The End Transaction dialog box opens as shown below

The Name box contains a list of the transaction names you defined in the current test. Select the name of the transaction you want to end. Decide where to insert the end of the transaction: To insert a transaction before the current step, select Before current step.

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<

To insert a transaction after the current step, select After current step.


Transactions and Step Generators AddWastedTime Method

Description This method specifies the wasted time (in milliseconds) for all open transactions.

Syntax Services.AddWastedTime (WastedTime) SetTransactionStatus Method Description Sets the status for all open transactions present

Syntax Services.SetTransactionStatus Status

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Transactions and Step Generators Step Generator: Enables you to add steps quickly and easily, by selecting from a range of context-sensitive options and entering the required values. In the Step Generator dialog box you can define steps that use:  Test object methods and properties  Utility object methods and properties  Calls to library functions, VBScript functions, and internal script functions

To open the Step Generator from the Keyword View or Expert View : While recording or editing, click the step which you want the new step to follow.

Choose Insert > Step > Step Generator or right-click the step and choose Insert Step > Step Generator. Alternatively, press F7.

The Step Generator dialog box opens and displays the object from the selected step in the Object box.

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Transactions and Step Generators To open the Step Generator from the Active Screen while editing: 1. Confirm that the Active Screen is displayed. If it is not, choose View > Active Screen or toggle the Active Screen toolbar button. 2. In the Keyword View or Expert View, click the step which you want the new step to follow. (When you finish defining the new step, QuickTest will insert it after this step.) The Active Screen displays the captured bitmap or HTML source corresponding to the selected step. 3. In the Active Screen, right-click the object for which you want to insert a step, and choose Step Generator. 4. If the location you clicked is associated with more than one object, the Object Selection - Step Generator dialog box opens. 5. Select an object and click OK. The Step Generator dialog box opens and displays the object from the selected step in the Object box.

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Transactions and Step Generators Defining a New Step: When you define a new step, you first select the type of step that you want to add to your test or component. You can then select the specific object and method for the step, or the function that you want the step to use.

Selecting the Type of Step to Add In the Category list box, you can choose one of the following options: Test Objects: Enables you to select a test object and method for the step.

Utility Objects: Enables you to select a utility object and method for the step.

Functions: Enables you to select a function for the step from one or all the available libraries. Numerous other operations such as GetROProperty, SetTOProperty, WaitProperty, etc. can be done using this Step Generator function.

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Exception Handling and Recovery Scenarios

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Exception Handling and Recovery Scenarios On Error Resume Next : This statement causes execution to continue, despite a run-time error. On Error Go to 0 : This statement is used to disable error handling, if it is previously enabled using On Error Resume Next. Debugging : ♠ In QTP there is a window called Debugging window which contains three tabs ♠ Watch Expressions ♠ Variables ♠ Command Watch Expressions: ♠ If the user is concerned about one or more specific variable value or values of some vbscript expression, then the user can enter those variable names in the first column of the watch expression tab. ♠ When the test case is run in a step-by-step mode using breakpoints, we can see the current value of the variables/ vbscript expression entered in the first column of the watch expression tab.

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Exception Handling and Recovery Scenarios Variables: ♠ User can check all the initialized variables and their values during the program execution in the Variables tab. Entire initialized variable names and its current value are displayed. ♠ During program execution if the value of any variable changes, the same will get reflected in the Variables tab. Hence the user can easily analyze the code with this.

Commands: ♣ This tab helps in modifying the values of the variables at run time (while executing the script in step-by-step format). ♣ During execution, user can insert breakpoint and the execution will suspend when it reaches any break point.

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Exception Handling and Recovery Scenarios ♠ Let us assume the variable strVarName = “very good”. ♠ At this point the user can enter the variable name and assign the new value to check whether the code works fine, if new value is assigned at this moment.

♠ For eg. the user enters strVarName = “Hi this is the new value” in the Command tab. ♠ After entering the new value, if the user starts running the script from that step, the new value will be considered as the current value of the variable. ♠ By changing the variable value during the execution time, user can make sure if the variable attains the mentioned value.

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Exception Handling and Recovery Scenarios Automation of QTP: ♠ Let us discuss two scenarios where automation of QTP is preferred. ♠ When more users are involved in an automation project then scripts generated by these users may not be of same standards and hence when integration of scripts gives problems. ♠ When automated scripts are moved to client, in client location, we may need to do configuration of QTP and associate other files/paths such as library files, folder paths, recovery scenario files, environment files etc... ♠ In both these cases lot of effort is required and the person who is doing such configuration must be very sure of what he is doing, otherwise proper execution of the script won’t happen. ♠ We can easily create such programs by utilizing the “Generate Script” functionality provided in QTP. ♠ This “Generate Script” functionality is provided in three places ♠ From these three sections, we can create 3 VBScript files, which can be combined together to create a final VBScript file, if required which can perform all the above mentioned functionalities.

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Exception Handling and Recovery Scenarios Generate Script – Object Identification: ♠In this section we can set the Mandatory properties, Assistive properties, Smart Identification configuration etc for all kinds of objects for all the loaded add-ins.

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Exception Handling and Recovery Scenarios Generate Script – Test Settings : ♠ Through the highlighted button, we can generate the script which will set the associated add-ins with this test case, ♠ Run options (Run on all rows, Run one iteration only... for global sheet) Library files, Parameters, Recovery scenario files, ♠ Load environment variable files, Browser navigation timeout settings, Username and Password settings for accessing the application through the Active screen. ♠ The easiest way to create the custom file is by setting the proper configuration once, and generate the script with the help of this button.

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Exception Handling and Recovery Scenarios Generate Script – Tools/Options : ♠ In the above mentioned section we can create the script to control the general settings which are applicable for all the test cases. ♠ We can set the folder paths, amount of information that should be captured through Active screen, enable/disable the integration of QTP with other mercury tools, execution mode (Fast/Normal), capturing of screen shots during (error, always, never, on errors and warnings), and advance web settings.

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Exception Handling and Recovery Scenarios Optional Steps : ♠ When running a test or component, if a step in an optional dialog box does not open, QuickTest will bypass this step and continue to run the test. ♠ When the run session ends, a message is displayed for the step that failed to open the dialog box, but the step does not cause the test or component to fail.

♠ To set an optional step in the Keyword View, right-click a step and choose Optional Step. The Optional Step icon is added next to the selected step. ♠ An optional step can be added in the Expert View by adding OptionalStep to the beginning of the VBScript statement. ♠ Example: OptionalStep.Browser("browser_name").Page("page_name").Link("link_name")

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Exception Handling and Recovery Scenarios Recovery Scenarios : ♠ Unexpected events, errors, and application crashes during a run session can disrupt your run session and distort results. This problem may stop execution of tests. ♠ The Recovery Scenario Manager provides a wizard that guides you through the process of defining a recovery scenario ♠ A recovery scenario consists of the following: Trigger Event : The event that interrupts your run session. For example, a window that may pop up on screen, or a QuickTest run error. Recovery Operation(s): The operation(s) that need to be performed in order to continue running the test or component. For example, clicking an OK button in a pop-up window, or restarting Microsoft Windows. Post-Recovery Test Run Option: The instructions on how QuickTest should proceed once the recovery operations have been performed, and from which point in the test or component QuickTest should continue, if at all. For example, you may want to restart a test or component from the beginning, or skip a step entirely and continue with the next step in the test or component.

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Exception Handling and Recovery Scenarios Steps for creation

Step 6: Define a recovery operation and click on next button

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Exception Handling and Recovery Scenarios Steps for creation

Step 12: Click finish if you like to quit or proceed with available options

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Exception Handling and Recovery Scenarios  Care must be taken when you are adding more than one recovery scenario in a script.

 Since there is limited time for the Recovery Scenario to kick off, the most frequently used recovery scenario should be at the top of the list and the list should later be refined as the interaction with the AUT increases.

 Recovery scenarios do not get executed when QTP is in a Wait loop, i.e. if we have a wait statement after a particular step (say for about 15 sec) then the Recovery Scenario will not get executed for the entire wait period and in the meantime it is quite possible that the AUT has moved from the screen that was expected resulting in a failure of the Recovery Scenario

Take care when using recovery scenarios

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Analysis of Test Results

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Analysis of Test Results

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Analysis of Test Results What is formatting of Results and when is it used? ♥ After the test execution completes, displaying the execution results in a more readable format is called formatting of Result reporting. ♥ When the test cases are executed through these automation tools, then it may be difficult for the users to understand the result of such execution. These reports can be generated from Test Director, but this comes as mandatory if the client is having only QTP and not Test Director.

How is it used? ♥ We can write VBScript library functions which can get the information from calling action/function, open the excel sheet, enter the result in the specified row and column in the specified format (Bold, italic....). ♥ Library functions written can be used to create text file to log all the result which in turn will act as log files for the execution of test cases. However, excel sheet or Html format will give very clear picture about the result than a text file.

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Analysis of Test Results Various types ♥ We can write functions such that whenever a test case is run, it will create a new folder with current system date and time and ●

Create a new excel file and create one excel sheet for each test case i.e. create one excel file and N no of excel sheets for N no of test cases.

Create one excel file/ sheet for each test case

Create one excel file per test case and N no of sheets for N no of iterations of same test case

Create one Batch folder which will create one excel file/sheet and report the details of all the test cases that was executed in the batch – to give the consolidated information about the execution of the batch. To find the individual execution results, individual excel file can be analysed.

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


Analysis of Test Results Environment Variables ♥ Variables that can be set to a particular value and the value can be used throughout the script, across actions. ♥ There are two types of environment variables: – Built-in –

User-defined

Build-in Variables: ♥ As the name suggests, Built-in environment variables are those environment variables that are predefined User Defined: ♥ User defined environment variables are ones in which the user gives the value and name of the environment variable and this value holds good throughout the script.

>>>>>>>>>>>> www.quontrasolutions.com <<<<<<<<<<<<


info@quontrasolutions.com

www.quontrasolutions.com

For More Details Contact us

Quontra Solutions Visit: http://www.quontrasolutions.com/ Email: info@quontrasolutions.com Call Now : US: +1 (404)-900-9988. UK: (20)-3734-1498. info@quontrasolutions.com


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.