22
Copyright 2015 IT Professional Academy 1 Automation (QTP) Testing Course DAY - 2

QTP Automation Testing Tutorial 2

Embed Size (px)

Citation preview

Page 1: QTP Automation Testing Tutorial 2

Copyright 2015 IT Professional Academy 1

Automation (QTP) Testing Course

DAY - 2

Page 2: QTP Automation Testing Tutorial 2

Copyright 2015 IT Professional Academy 2

Topics for TodayWhat is QTP and License Types    i. Floating    ii. Node LockQTP Introduction    i. About QTP    ii. Support OS & BrowsersAbout QTP utility programme    i. Add In Manager    ii. QTP supported TechnologiesQTP window or QTP Editor Components ( 6 / 11 Panes)    i. Test Pane ( key word view and expert view)    ii. Data table    iii. Active screen    iv. Debug viewer -- Upto 8.2    v. Information pane    vi. Missing resource Pane --- Upto 9.2    vii. Test flow    viii. Available key words    ix. ResourcesQTP Logical Structure Record and Playback

Page 3: QTP Automation Testing Tutorial 2

Copyright 2015 IT Professional Academy 3

What is QTP?•QTP is a Functional Automation tool by HP. Now called as UFT. i.e. unified functional tool. Latest version is UFT 12.5

•Validates functional flows of the Application.

•Not fully capable of validating UX, color, position, location, intuitiveness etc of the application.

Page 4: QTP Automation Testing Tutorial 2

Copyright 2015 IT Professional Academy 4

QTP LicenseSeat License: This type of license is present on the client machine itself. No server involved.

Concurrent License: License is located at the server and multiple machines access to get license details. Most common type of license arrangement.

Page 5: QTP Automation Testing Tutorial 2

Copyright 2015 IT Professional Academy 5

OS and ApplicationsOS: Windows only includes client as well as server.

Applications: Internet Browsers namely IE, Chrome, Firefox. (Limited Versions Only)Windows based Applications:SAP, Silverlight, VB, Java, Dot Net etc

QTP Browser Support Matrix

Click on the Icon to the right for QTP and Browser Support Matrix:

Page 6: QTP Automation Testing Tutorial 2

Copyright 2015 IT Professional Academy 6

QTP Logical Structure:QTP Basic Structure•Tests: Top most Logical entity.•Actions: Multiple actions in a Test. Actions contains the actual code.•Object Repository: A file which contains object’s details like, name, property, property value, descriptions.•Data Tables: Part of every QTP test. Can be used to read and write data which can be used during script execution.•Function Library: Stores Function Library and can be attached to Test. Functions will available to all the Actions in the Test•Object Spy: To read\Analyze the object properties of the Application.

Page 7: QTP Automation Testing Tutorial 2

Copyright 2015 IT Professional Academy 7

TestPlace Holder for Code, Data and

Object Repositories

Actions Function Library Data Tables Shared OR

QTP Structure: Components

Local OR

Page 8: QTP Automation Testing Tutorial 2

Copyright 2015 IT Professional Academy 8

Components Interrelationship:TEST

Action1 Action2 Action..n

Action1OR

Action2OR

Action..n

OR

FunctionLibrary

Data-Tables

Page 9: QTP Automation Testing Tutorial 2

Copyright 2015 IT Professional Academy 9

QTP Test:

Page 10: QTP Automation Testing Tutorial 2

Copyright 2015 IT Professional Academy 10

QTP-AUT Interaction

OS

QTP

BROWSER

SELENIUM

InterfaceInterface

WIN APP

Interface

Page 11: QTP Automation Testing Tutorial 2

Copyright 2015 IT Professional Academy 11

QTP-AUT Interaction

OS

QTP

AUT

Interface

VB

Script

User and QTP interact in VB Script language.

QTP and AUT interface is managed by Add-in manager in QTP.

Page 12: QTP Automation Testing Tutorial 2

Copyright 2015 IT Professional Academy 12

QTP Set Up•QTP 10 works on windows XP.

•Windows Virtualization is to be Used to Run Windows XP over Windows 7.

•Oracle VM can also be used to achieve virtualization.

Page 13: QTP Automation Testing Tutorial 2

Copyright 2015 IT Professional Academy 13

QTP Record and PlaybackRecording: While recording, QTP records user’s commands\statements and targets\Objects description.

Objects Description: Is Stored in Object repository. Stored Object is also called TO (Test object).

Commands: Is stored in Actions under QTP Test.

Playback: When script is replayed, QTP reads the statements\commands from the script and try to find the similar object in the AUT. If target is found, command is executed; if not test fails.

Page 14: QTP Automation Testing Tutorial 2

Copyright 2015 IT Professional Academy 14

QTP Record and Playback

Object Repository:

Object 1

Object 2

TO mapping with RO.

Failed

TO mapping with RO.

Passed

Test Object is Mapped with Run Object during Playback.

AUT

Page 15: QTP Automation Testing Tutorial 2

Copyright 2015 IT Professional Academy 15

Object Spy:•Is used to analyze objects of the Application.

•It records Properties and Their corresponding values.•It also displays Object Hierarchy.•Once invoked will start reading the Application Properties.•Press control key to move Object Spy window.

Page 16: QTP Automation Testing Tutorial 2

Copyright 2015 IT Professional Academy 16

What is VBScript?

•A Safe subset of visual basic•The VBScript Code is case Insensitive.•Microsoft Visual Basic Scripting Edition brings active scripting to a wide variety of environments, including Web client scripting in Microsoft Internet Explorer and Web server scripting in Microsoft Internet Information Service (IIS).

Page 17: QTP Automation Testing Tutorial 2

Copyright 2015 IT Professional Academy 17

VBScript data type?•VBScript has only one data type called a Variant. •A Variant is a special kind of data type that can contain different kinds of information, depending on how it is used. •Because Variant is the only data type in VBScript, it is also the data type returned by all functions in VBScript. •At its simplest, a Variant can contain either numeric or string information. •A Variant behaves as a number when you use it in a numeric context and as a string when you use it in a string context.

Page 18: QTP Automation Testing Tutorial 2

Copyright 2015 IT Professional Academy 18

VB Script Example : Calculator1.VB Script Editor2.Create a .vbs File3.Create a simple Program for Addition and

Display the result.4.Calculator Program for Add, Subtract,

Multiply and Divide.5.Walk thorough the VB Script Code to

Automate IE.

Page 19: QTP Automation Testing Tutorial 2

Copyright 2015 IT Professional Academy 19

VB Script Example:CalculatorDim Num1Dim Num2Dim resultNum1 = InputBox("Enter First Number","My First Calculator Program") Num2 = InputBox("Enter 2nd Number","My First Calculator Program") operation = InputBox("What you wish to do? For Add enter '+'; for subtract enter '-'; for

multiply enter '*'; for division enter '/'","My First Calculator Program") Select case trim(operation)

Case "+"result = Int(Num1) + Int(Num2)msgbox result

Case "-"result = Int(Num1) - Int(Num2)msgbox result

Case "*"result = Int(Num1) * Int(Num2)msgbox result

Case "/"result = Int(Num1) / Int(Num2)msgbox result

Case "\"result = Int(Num1) / Int(Num2)msgbox result

Case Elsemsgbox "Incorrect Operation"

End Select

Page 20: QTP Automation Testing Tutorial 2

Copyright 2015 IT Professional Academy 20

VB Script Example: Calculator and Automate Browser

CalculatorProgram

Automate Browser

Note: Click on the Icons to Invoke the Program.

Page 21: QTP Automation Testing Tutorial 2

Copyright 2015 IT Professional Academy 21

Assignment: Record and PlaybackOpen QTP.Use Add-In: WebCreate New TestSelect Action 1, click on Record button. A Window with Record and play Back Settings will appear.Enter URL as : http://parabank.parasoft.com/parabank/index.htmClick on ok. Window is closed and IE with the mentioned page is opened.

Click on the Register link. Page navigates to registration form.Enter values in the field and click register link.Register successful page appears. 

Task:Add text Check points for Register page and Register confirmation page.Add Synchronization point.Advanced: Add logic for multiple registrations.

Page 22: QTP Automation Testing Tutorial 2

Copyright 2015 IT Professional Academy 22

QTP DAY 2 Ends.

Thank you.