testing tools-qtp

42
TESTING TOOLS Quick Test Professional 1

Upload: srinivas-reddy

Post on 02-Apr-2015

147 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Testing tools-QTP

1

TESTING TOOLS

Quick Test Professional

Page 2: Testing tools-QTP

2

QTP Testing Process

It Consists of Seven main phases.Preparing to recordRecording a session on your applicationEnhancing your testDebugging your testRunning your testAnalyzing the test resultsReporting the Defects.

Page 3: Testing tools-QTP

3

Test Pane Test pane is used to view the recorded script

or to write a new script for an object. There are two types of views in test pane. They are:1. Key word view: In this view you can select

the object from object repository and can insert an method to it.

2. Expert view: In this view you can write the code directly.

Page 4: Testing tools-QTP

4

Other components present in this pane are:1. Data Table: There are 2 types of sheets.

○ i. Global Sheet: This enables you to share information from one action to another action.

○ Ii. Action Sheet: Each action has its own sheet in the data table. So that you can insert data that applies to only that action.

2. Active Screen: The Active screen provides a snapshot of your application, as it appeared when you performed a certain step while recording your test. This enables you to easily parameterize object values and insert checkpoints, methods and output values for any object in the page

Page 5: Testing tools-QTP

5

Object Repository When we want to write scripting on any

window then we have to learn the window before starting scripting in order to recognize each and every object present in the application by the tool.

It is used to learn all the objects properties in a window or a single object’s properties of a window.

NavigationStart Quick Test Professional Quick Test

Professional Tools Object Repository.

Page 6: Testing tools-QTP

6

GUI Spy GUI Spy is used when ever the user want to

know the properties of an object.

It will display the entire information of the object which we are specifying or selecting.

NavigationStart Quick Test Professional Quick Test

Professional Tools GUI Spy.

Page 7: Testing tools-QTP

7

Run Modes After completion of scripting for an object we

need to run it for result. So according to it there are 2 types of run modes according to their functionality. They are:1. Debug: For displaying the results temporarily

and it is used for checking the running of the script.

2. Verify: For displaying and to store the result in a specified path and the results can be viewed at any time.

Page 8: Testing tools-QTP

8

Recording Modes Recording modes are used to record the

movements of the mouse, keyboard insertions and selection of objects in the window. According to its functionalities these are divided in to three types. They are:1. Normal Recording2. Analog Recording3. Low Level Recording

Page 9: Testing tools-QTP

9

Recording Modes Normal Recording

To record the objects in your application and the operations performed on them. By default the recording mode will be Normal Recording mode.

Analog RecordingTo record the every movement of the mouse. It is

used signatures and drawing purpose. Low-Level Recording

Low-Level is used for recording on environments or objects not supported by quick test and it is used when you need to record the exact location of the object on your application screen

Page 10: Testing tools-QTP

10

Check Points A checkpoint is a verification point that compares

a current value for a specified property with the expected value for that property.

There are 7 types of check points. They are:1. Standard Check Point.2. Text Check Point.3. Text Area Check Point.4. Bitmap Check Point.5. Database Check Point.6. Accessibility Check Point.7. XML Check Point.

Page 11: Testing tools-QTP

11

1. Standard Check Point It is used to check the properties of an

object. It may be a single property or multiple properties we can implement by using this single check point.

Navigation:Quick Test Professional Click on Insert tab

Select Check Points Select Standard Check Point.

Page 12: Testing tools-QTP

12

2. Text Check Point

It is used to check the content of the text present in the window/object which is being specified or selected for checking.

Navigation:Quick Test Professional Click on Insert tab

Select Check Points Select Text Check Point.

Page 13: Testing tools-QTP

13

3. Text Area Check Point It is used to check the content of the text

present in the selected portion of window/ object which is being specified or selected for checking.

Navigation:Quick Test Professional Click on Insert tab

Select Check Points Select Text Area Check Point.

Page 14: Testing tools-QTP

14

4. Bit Map Check Point It is used to check the bitmap images

present in the window/object. And we can check the selected portion of the image

Navigation:Quick Test Professional Click on Insert tab

Select Check Points Select Text Area Check Point.

Page 15: Testing tools-QTP

15

5. Database Check Point

It is used to check the database connectivity and the retrieval of content from the database.

Navigation:Quick Test Professional Click on Insert

tab Select Check Points Select Database Check Point.

Page 16: Testing tools-QTP

16

6. Accessibility Check Point

Accessibility check point used to identify the areas of your Web site that may not conform to the World Wide Web Consortium (W3C) Web Content Accessibility Guidelines.

Navigation:Quick Test Professional Click on Insert tab

Select Check Points Select Accessibility Check Point.

Page 17: Testing tools-QTP

17

7. XML Check Point

XML check point is used to check the data content of XML documents in XML files or XML documents in Web pages and frames.

Navigation:Quick Test Professional Click on Insert tab

Select Check Points Select Accessibility Check Point.

Page 18: Testing tools-QTP

18

Out Put Values An output value is a step in which one or

more values are captured at a specific point in your test or component and stored for the duration of the run session. The values can later be used as input at a different point in the run session.

Navigation:Quick Test Professional Click on Insert tab

Select Output values.

Page 19: Testing tools-QTP

19

Out Put Values

There are 7 types of output values according to their functionalities. They are:1. Standard output values2. Text output values3. Text Area output values4. Database output values5. XML output values

Page 20: Testing tools-QTP

20

1. Standard Output Value

Standard output values is used to output the property values of most objects.

You can use standard output values to output text strings by specifying the text property of the object as an output value.

Navigation:Quick Test Professional Click on Insert tab

Select Output values Select Standard output value.

Page 21: Testing tools-QTP

21

2. Text Output Value

Text output value is used to output text strings displayed in a screen or Web page.

Navigation:Quick Test Professional Click on Insert tab

Select Output values Select Text output value.

Page 22: Testing tools-QTP

22

3. Text Area Output Value

Text Area output value is used to output text strings displayed in a screen or Web page. When creating a text output value, you can output a part of the object’s text.

Navigation:Quick Test Professional Click on Insert tab

Select Output values Select Text Area output value.

Page 23: Testing tools-QTP

23

4. Database Output Value

Database output values is used to output the value of the contents of database cells, based on the results of a query.

Navigation:Quick Test Professional Click on Insert tab

Select Output values Select Database output value.

Page 24: Testing tools-QTP

24

5. XML Output Value

XML output values is used to output the values of XML elements and attributes in XML documents.

Navigation:Quick Test Professional Click on Insert

tab Select Output values Select XML output value.

Page 25: Testing tools-QTP

25

Step Generator Step Generator is used to insert an specified

function or step. If you select functions in the category box list,

you can choose one of the following options from the library box list:All—Enables you to select a function from all the

available functions and types.Library functions—Enables you to select a

function from any library file associated with your test or component.

Page 26: Testing tools-QTP

26

Step GeneratorBuilt-in functions—Enables you to select any

standard VBScript function supported by Quick Test.

Local script functions—Enables you to select any local function defined directly in the current action or component.

You can select the required function from the operation box list, which displays the functions available for the selected function type in alphabetical order.

Page 27: Testing tools-QTP

27

Data Driven Test Data driven test is used to assign a bunch of

data for an object to run continuously up to the end of data.

Procedure to follow is:1. Parameterize the values2. Local and Global Data Tables

Page 28: Testing tools-QTP

28

1. Parameterizing the values

Record ON. Perform the complete operation for what you

need to do data driven test. Stop recording. Block the value which you need to

parameterize. Tools Data Driver…Click on

parameterize… Click on Next Click on Next Click on Finish Click on OK.

Page 29: Testing tools-QTP

29

2. Local and Global Data Tables

Local and Global Data Tables are used to store or enter data into them.

After completion of parameterization a column will be displayed with the parameterized value. So enter some more data which has to be tested.

Page 30: Testing tools-QTP

30

Some of the functions 1. InputBox Method:

String expression displayed as the message in the dialog box.

Syntax:var=InputBox(prompt)

Example:Z=inputbox ("Enter your name")If z="srinivas" Then dialog("Login").WinEdit("Agent Name:").Set z dialog("Login").WinEdit("Password:").SetSecur e

"mercury"End If

Page 31: Testing tools-QTP

31

2. Wait Method:It will wait until the specified object property

achieves the specified value or exceeds the specified timeout before continuing to the next step.

Syntax:var=Wait(Seconds)

Example: Z=wait(“5”) Msgbox “waited upto 5 seconds” ‘the execution will wait until the specified

time expires

Page 32: Testing tools-QTP

32

3. Capture Bitmap Method : This method saves a screen capture of the

object as a .png or .bmp image using the specified file name.

Syntax:object.CaptureBitmap FullFileName,

[OverrideExisting]

Example: Dialog("Login").CaptureBitmap

“d:/sri.bmp”,true/false

Page 33: Testing tools-QTP

33

4. Exists property Method: It checks whether the object currently exists in

the open application.

Syntax: object.Exist([TimeOut])

Example: If (Dialog("Login").Exist) then Dialog(“Login”).winedit(“Agent

Name:”).set “srinu” Dialog(“Login”).winedit(“Password:”).

Setsecure “mercury” Dialog(“Login”).winbutton(“OK”).click Endif

Page 34: Testing tools-QTP

34

5. GetToProperty Method:This method will be returning the value of a specified property

for a test object. The value is taken from the Object Repository.

Syntax:object.GetTOProperty(Property) 

Examplez=Dialog("Login").GetTOProperty ("nativeclass")If z=true Then msgbox "The Login window’s native class is present in

Object Repository" else msgbox " The Login window’s native class is not present

in Object Repository "End If

Page 35: Testing tools-QTP

35

GetRoProperty Method:It returns the current value of the test object

property from the object in the application. Syntax:

object.GetROProperty (Property, [PropertyData]) Example:

z=Dialog("Login").GetROProperty("focused")If z=true Then msgbox "The Login window is focussed" else msgbox "The Login window is not

focussed"End If

Page 36: Testing tools-QTP

36

GetItem Method: Returns the current value of the item specified to the output.

Syntax: object.Getitem(number)

Example Window("Flight Reservation").Activate Window("Flight Reservation").ActiveX("MaskEdBox").Type "121212" Window("Flight Reservation").WinComboBox("Fly From:").Select "Denver" Window("Flight Reservation").WinComboBox("Fly To:").Select "Frankfurt" Window("Flight Reservation").WinButton("FLIGHT").Click a=window("Flight Reservation").Dialog("Flights Table"). WinList("From").

GetItem(1) Window("Flight Reservation").Dialog("Flights

Table").WinList("From").Select a Window("Flight Reservation").Dialog("Flights

Table").WinButton("OK").Click Window("Flight Reservation").WinEdit("Name:").Set "sdfgh" Window("Flight Reservation").WinButton("Insert Order").Click

Page 37: Testing tools-QTP

37

GetItemPropertyReturns the current value of the specified

property for the specified menu item.

Syntax:object.GetItemProperty (Item, Property)

Example:Z = Window("Flight

Reservation").WinMenu("Menu").GetItemProperty("File", "SubMenuCount")

Msgbox z

Page 38: Testing tools-QTP

38

Create Text File MethodCreates a specified file name and returns a text-

stream object that can be used to read from or write to the file.

Syntax:  object.CreateTextFile(filename[, overwrite[,

unicode]])

Example:Set fso=createobject

(“Scripting.FileSystemObject”)Z = fso.CreateTextFile("c:\\testfile.txt", true);

Page 39: Testing tools-QTP

39

CreateFolder Method Creates a folder in the address location where we

are specifying.

Syntax:Object.CreateFolder(foldername)

Example:Set

fso=createobject(“System.FileScriptingObject”)f = fso.CreateFolder("c:\srinu")

Page 40: Testing tools-QTP

40

GetVisibleText Method:This method is used to return the text from the

specified area. Syntax:

object.GetVisibleText ([Left], [Top], [Right], [Bottom]) Example:

Window("Flight Reservation").ActivateWindow("Flight

Reservation").WinMenu("Menu").Select"Help;About..."Window("Flight Reservation").Dialog("About Flight

Reservation").Activatea=window("Flight Reservation").Dialog("About Flight

Reservation").GetVisibleTextmsgbox a

Page 41: Testing tools-QTP

41

LCase Method:The input may be any thing either in uppercase

or upper & lower mixed but it returns a string that has been converted to lowercase.

Syntax:LCase(string) 

Example:A=inputbox("Enter your name")B=lcase(A)msgbox B

Page 42: Testing tools-QTP

42

UCase Method:The input may be any thing either in lowercase

or upper & lower mixed but it returns a string that has been converted to uppercase.

Syntax:UCase(string) 

Example:A=inputbox("Enter your name")B=ucase(A)msgbox B