qtp elite)

101
SR. NO. WINRUNNER QTP 1 It is a product of Mercury Interactive It is a product of Mercury Interactive/HP 2 It is a W indows Ba sed Appli cation It is a W indows Bas ed Applic ation 3 It supports only Windows Based Application It supports both Windows Based Application and W eb Application 4 It doesnot support test on .Net Application It supports test on .Net Application 5 DataT able and ActiveScreen V iews are Absent Data T abl e and Act ive Scree n V iews are Present 6 Scripting Language is TSL-Test Scripting Language Scripting Language is VB(V isual Basic) Scripting 7 It doesnot support t est on ERP  packages(SAP,Peoplesoft,Oracle abs) It supports test on ERP  package s(SAP ,Peoplesoft,Oracle abs)

Upload: preetesh-singh

Post on 09-Apr-2018

238 views

Category:

Documents


0 download

TRANSCRIPT

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 1/101

SR.

NO. WINRUNNER QTP

1

It is a product of Mercury

Interactive It is a product of Mercury Interactive/HP

2It is a Windows Based Application It is a Windows Based Application

3It supports only Windows Based

Application

It supports both Windows Based

Application and Web Application

4It doesnot support test on .Net

Application

It supports test on .Net

Application5DataTable and ActiveScreen Views

are Absent

DataTable and ActiveScreen Views

are Present6Scripting Language is TSL-Test

Scripting Language Scripting Language is VB(Visual Basic) Scripting

7It doesnot support test on ERP

 packages(SAP,Peoplesoft,Oracle

abs)

It supports test on ERP

 packages(SAP,Peoplesoft,Oracle abs)

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 2/101

By default five views are visible on QTP screen:

1.Keyword View

2.Expert View

3.Active Screen

4.Data Table

5.Information

Other two views are:-

6.Debug Viewer 7.Missing Resources

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 3/101

` Keyword View:Place to Develop Code by selecting

objects(keyword)

` Expert View:Developing Code Manually

`  Active Screen:Provides Snapshots for each line of code.

` Datatable:Place to store all test data or inputs

` Information:Provides information for Syntactical

Errors

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 4/101

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 5/101

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 6/101

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 7/101

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 8/101

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 9/101

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 10/101

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 11/101

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 12/101

` It is the First Screen Which appears after openingthe QTP i.e. Add ±in Manager 

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 13/101

`  Add in is use to identify particular technology

objects.

` By Default three Add ±In¶s are Available:-`  ActiveX

` Visual Basic

` Web

Other Add ins can also be added like java,.Net.etc

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 14/101

` Object Repository is a place where QTP stores

learned objects

` Object Repository: displays a tree of all objects in the

current component or in the current action or entire

test

`  A local object repository stores objects in a file that is

associated with one specific action, so that only that

action can access the stored objects

`  A shared object repository stores test objects in a file

that can be accessed by multiple tests.

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 15/101

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 16/101

` Two Types:

` 1.Manual

` 2.Automation

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 17/101

`  Automation:

` 1.Requirement Feasiblity

` 2.Developing Test Scripts

`

3.Enchancing the script` 4.Debugging the script

` 5.Executing the script

` 6.Collect the results

`

7.Result Analysis` 8.Find the Bugs

` 9.Log the Bugs

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 18/101

` QTP recognizes all objects in the Application

under test using the set of mandatory properties

that it stores for all Test Objects while recording. If 

QTP is not able to recognize the objects using theset of mandatory properties it uses object

identification to assign properties to that Object

using following procedure:-

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 19/101

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 20/101

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 21/101

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 22/101

We can Record(F3) the events and later it can be

played back(F5)

Types of Recording:

1. Normal Recording2.  Analog Recording

3. Low Level Recording

It gives 2 options: Record and run test on any open windows-based

application

Record and run on specific application.

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 23/101

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 24/101

` For playback just run the script.

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 25/101

Steps:1. Click on ³Record´ button.

2. Select ³Record Specific application´.

3. Click on ³+´ icon.

4. Click on ³OK´

5. Click on ³Apply´

6. Click on ³OK´

7. Perform some action on application.

8. Click on ³Stop´ button.9. Click on ³Run´.

10. Click on ³OK´

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 26/101

When we run test,time taken by different object mayvary.

Three ways of using synchronization: Synchronization Timeout.

It works with seconds File/Settings/Run

It is applicable for all line of code

It depends on task.

Use EXIST or WAIT statements.

It works with seconds

Syntax: wait xx It is applicable for on a point

It depends on time

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 27/101

Synchronization point It works with milliseconds In record mode,Click Insert,Click Synchronization

point,Select the object where we want synchronizationpoint then specify the timeout period in milliseconds.

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 28/101

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 29/101

` Virtual objects are used to give functionality

name to a object.

` A virtual objects are collected and it is stored in

the VirtualObject Manager.

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 30/101

Steps: ± Tools>Virtual objects>New Virtual Object

 ± Select class name

 ± Click Next

 ± Click Mark Object

 ± Mark Object with + ± Click on next>next

 ± Provide appropriate functionality name in Name edit box

 ± Provide the appropriate family name in VO collection box

 ± Click Next ,check no and then click Finish

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 31/101

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 32/101

Checkpoint is a verification point that comparesthe current value for a property with theexpected value for that property.

Types of checkpoint: Standard Checkpoint:Checks values of an object.

Text Checkpoint:Checks that a text string is displayed correctly andat specified location.

Text Area Checkpoint:Checks that a text string is displayed

correctly and at specified location.

Bitmap Checkpoint:Checks an area of an application

Database Checkpoint:Checks the contents of databases

 Accessibilty Checkpoint

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 33/101

xXML Checkpoint:Checks the data content of XML documents

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 34/101

In record mode,choose

Insert>Checkpoint>Standard Checkpoint.

Select the object .

Click ³OK´

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 35/101

Click on notepad symbol.

Enter the Expected Value,click Ok and OK

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 36/101

In QTP

1. Linear Framework:Just using Record

2. Modular:Developing the code

modulewise(Manual/Record) and enhancing the code3. Keyword Driven: Giving object and action a keyword

and using it in code

4. Data Driven:Getting each action and permission from

server 5. Hybrid:Combination of two or more framework

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 37/101

` It is used when we use function.

` When action is called all four thing are called viz.

code,datatable,active screen and OR

` Instead of that we can use function,where we justlink to a object repository

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 38/101

` Steps: Choose Resources>Object Repository>Tools> Associate

Repositories.

Click + icon

Select appropriate file with .tsr extension

Select available action and click->

Click OK

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 39/101

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 40/101

` In simple words it can be defined as ³Testing an

application with multiple inputs´

` It allows creating maintainable scripts which canrun with different data every time

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 41/101

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 42/101

Select data to be

parameterized

Click Parameterize

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 43/101

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 44/101

Give the

column name

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 45/101

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 46/101

` Recovery scenario helps the user as it indicates

QTP with regards to the corrective action needed

to be taken in case of the unwanted event

occurred during the test run

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 47/101

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 48/101

Click NEW

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 49/101

Select event

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 50/101

Click hand icon

select window

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 51/101

Name of selected

window

Objects of the

window

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 52/101

Select

operation

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 53/101

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 54/101

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 55/101

Select post

recovery options

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 56/101

` Output value extracts value from certain field

which can later used as input for other fields

during runtime.

`

To execute output value we have to first record theapplication

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 57/101

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 58/101

Select the

object

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 59/101

Select

property

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 60/101

Output Name column iscreated

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 61/101

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 62/101

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 63/101

` Function can be defined as a group of code

which can be called again and again whenrequire with no need to write the code again

& again.

` The syntax for function is

Function function_name

code

}End function

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 64/101

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 65/101

Function is called

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 66/101

` Descriptive programming is used when we

want to perform an operation on an object

that is not present in the object repository.

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 67/101

In descriptive programming object is not added in

the object repository.

Thus the object to be used are identified usingobject spy.

The use of invoke is must in descriptive

programming.

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 68/101

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 69/101

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 70/101

` Step generator is a feature available in QTP which

helps to generate the script without recording

and/or without typing the script in Expert View.

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 71/101

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 72/101

i) Application Under Test should be opened

ii)Press F7 in Qtp

OR

ii) Go to tool bar of the QTP :

-Insert.

-Step Generator.

-Select Category as 'Test Objects' .

-Insert another step should be selected.

on the 'Step Generator' dialog box.

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 73/101

i) Application Under Test should be openedii)Press F7 in Qtp

ORii) Go to tool bar of the QTP :

-Insert.

-Step Generator.-Select Category as µFunctionsµ .-Select Library as µAll¶ or µBuilt-in¶-Select Operation as µInvokeApplication¶.-Click Value text box for Command for Argument Option.-In constant Textbox Specify the path of the AUT.

-Insert another step should be selected.on the 'Step Generator' dialog box.

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 74/101

` The Function µInvokeapplication¶ is used to Invoke

the application Multiple time.

Expert View

Keyword View

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 75/101

OBJECT SPY

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 76/101

` The Object Spy enables you to view both the run-

time object methods and the test object methods

associated with an object and to view the syntax

for a selected method.

` You use the Object Spy pointer to point to an

object.

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 77/101

` Keep the application ,on which we want to use

object spy, in an Open state.

` Click the object spy icon on Tool bar 

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 78/101

Click On Hand icon

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 79/101

` Click on Hand icon in Object spy Window.

` Then Select the Object in the Application by

Pointing the hand icon over it and then Clicking it

once.

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 80/101

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 81/101

Object Hierarchy

tree

Properties Values

Object Methods

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 82/101

Object Methods

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 83/101

Descriptive ProgrammingCheck the Syntax for an object

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 84/101

Connecting QTP to QC

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 85/101

` To connect QTP and QC we need to install

TD or QC plug-in .

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 86/101

1) Click File -> Quality Center Connection.

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 87/101

3)Click Connect Button

4)Provide the User name & Password

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 88/101

) &

5)Click Authenticate

6)Select the domain and project

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 89/101

) p j

7)Click Login

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 90/101

Icon indicates that QTP is connected to

QC

8)Click save As

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 91/101

8)Click save As

9)Now all QTP files will be saved

to Quality center 

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 92/101

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 93/101

1.Record the code

2.Go to Resources>Object Repository

3.Go to description and click on <#>

4.Change variable data of constant field by *.*

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 94/101

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 95/101

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 96/101

This symbol

indicates

Object is a Regular 

expression

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 97/101

Import & Export

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 98/101

Global sheet to be

exported

This Statement will create/overwrite the

Output.xls file and will write the global

sheet in it.

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 99/101

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 100/101

The statement will import

the Entire XL sheet at Runtime

8/8/2019 Qtp Elite)

http://slidepdf.com/reader/full/qtp-elite 101/101

Runtime sheet imported from

Output.xls