87
Automation Testing Training(QTP) Rajesh Valluru

Automation Testing Training(QTP)

Embed Size (px)

Citation preview

Page 1: Automation Testing Training(QTP)

Automation Testing Training(QTP)

Rajesh Valluru

Page 2: Automation Testing Training(QTP)

Session Objectives

Introduction to Automation Benefits of Automated Testing Automated Testing Process Introduction to QTP and its Salient

Features Environment Supported

Page 3: Automation Testing Training(QTP)

Introduction to Automation

Manual TestingDrawbacks of Manual testing

Manual testing is time-consuming and tedious. Requiring a heavy investment in human resources. Time constraints often make it impossible to manually test

every feature thoroughly before the application is released. Low reliability

Page 4: Automation Testing Training(QTP)

Why Automation ?

◦ Fast ◦ Reliable ◦ Repeatable ◦ Programmable ◦ Comprehensive ◦ Reusable

Benefits of Automated Testing

Automated Testing

Page 5: Automation Testing Training(QTP)

Tests that need to be run for every build of the application (sanity check, regression test).

Tests that use multiple data values for the same actions (data driven tests)

Stress/load testing

Tests requiring a great deal of precision

Which Test Cases to Automate?

Page 6: Automation Testing Training(QTP)

Which Test Cases Not to Automate? Usability testing

◦ "How easy is the application to use?“ One-time testing "ASAP" testing

◦ "We need to test NOW!“ Ad hoc/random testing

based on intuition and knowledge of application

Page 7: Automation Testing Training(QTP)

Leading Automation Tools available in the Market For Functional testing

WinRunner QTP

Rational Robot

Silk Test

QA Run

Page 8: Automation Testing Training(QTP)

Automated Testing Process

Automated testing involves three main steps

Creating Script(s)

Executing Script(s)

Analyzing Result(s)

Page 9: Automation Testing Training(QTP)

QTP has user-friendly Browser, At a Glance we can have a look of Scripts, Active Screen and the Data XL Sheet.

QTP uses VB Script while win runner uses TSL which is C language based

QTP has Recovery Manager

QTP generates output values and these can be used as input values to other Objects

Advantages of QTP over Win runner

Page 10: Automation Testing Training(QTP)
Page 11: Automation Testing Training(QTP)

Introduction to QTP Quick Test Professional is the flagship functional testing tool

from Mercury Interactive. Now HP undertaken it.

It is an icon based tool, which automates the functional & regression testing of an application.

QTP is easier to use and implement for both technical & non technical testers in comparison to other functional testing tools available.

Available versions are QTP 8.2,9.2 and 9.5

Page 12: Automation Testing Training(QTP)

Its Active Screen technology offers a Point-and-check interface for accessing & interacting with the components of the application under test.

QTP produces an Icon-Based test tree in which each branch represents a step in the business process

Testers can view and edit their test using either the tree view, an Icon-Based representation, or the expert View, which reveals the VBScript test that QTP automatically generates.

QTP can automatically introduce Checkpoints

Salient Features

Page 13: Automation Testing Training(QTP)

During execution testers can manually insert several types of check points to verify that the objects continue to behave as expected. These check points are shown in the presentation in the later stage

Testers are able to record their tests so that each action, or step in the business process are modular & reusable.

When application under test changes, testers can update Object Repository, thus the change made is then propagated across all the scripts that reference to this object

EX: In the Authentication screen when the name of the button is changed to Sign In form Login, Just make an update in the Object Repository.

Salient Features

Page 14: Automation Testing Training(QTP)

After running a test QTP displays the results in a tress structure and in clear visual reports

Scripting Language is VBScript which is easy to use , understand and program even complex functionalities with ease..

Library files contains VBScript functions and subroutines that can be added to the test.

Support Modern Development Environment.

Salient Features

Page 15: Automation Testing Training(QTP)

Quick Test testing process

The Quick Test testing process consists of 7 main phases:

◦ Preparing to record ◦ Recording a session on your application ◦ Enhancing your test ◦ Debugging your test ◦ Running your test ◦ Analyzing the test results ◦ Reporting defects

Page 16: Automation Testing Training(QTP)

Add–In Manager

DefaultActiveXVisual BasicWeb

Additional

JavaOraclePeopleSoft.NETTerminal EmulatorSap, Siebel & Web services

Page 17: Automation Testing Training(QTP)

Environments Supported

Basic Web Technologies◦ HTML◦ DHTML◦ XML

Browsers◦ Netscape◦ Internet Explorer◦ AOL

Advanced Web Technologies◦ JavaScript◦ Java◦ ActiveX

Page 18: Automation Testing Training(QTP)

Multimedia Technologies◦ Flash◦ RealAudio/Real Video◦ MS Media Player

ERP Solutions◦ mySAP.com◦ Siebel 2001◦ Oracle◦ PeopleSoft

.NET◦ Win Forms ◦ Web Forms◦ NET Control

Environments Supported

Page 19: Automation Testing Training(QTP)

◦ Web Services◦ XML◦ WSDL

Operating Systems◦ Windows XP/2003◦ Windows 2000◦ Windows 98◦ Windows NT◦ Windows ME

Environments Supported

Page 20: Automation Testing Training(QTP)

Environments Supported Terminal Emulators

◦ 3270◦ 5250◦ VT100

Languages

◦ European◦ Japanese◦ Chinese (traditional and simplified)◦ Korean

Page 21: Automation Testing Training(QTP)

Custom C/S • PowerBuilder • Forte • Delphi • Centura • Stingray • Smalltalk

ERP/CRM• Baan • PeopleSoft Windows • Siebel 5, 6 GUI Clients • Oracle GUI Forms

Environments not Supported

Page 22: Automation Testing Training(QTP)

QTP Screen

Page 23: Automation Testing Training(QTP)

Important Toolbars Test toolbar: containing buttons to assist you in the testing

process(ex: record, Run..)

Debug toolbar: containing buttons to assist you in debugging your test

Action toolbar: containing buttons and a list of actions, enabling you to view the details of an individual action or the entire test flow

Test pane: containing two tabs to view your test—the Keyword View and the Expert View

Test Details pane : containing the Active Screen

Data Table: containing two or more tabs to assist you in parameterizing your test—Global and one tab for each Action

Page 24: Automation Testing Training(QTP)

What you need to Know in QTP? How are the objects recognized? What is Object Repository? What is Object Recognition configuration? What is Active Screen? What is Keyword View and Expert View? What are Actions? What are the checkpoints available? Output Values Synchronization Point Data Driven Tests Transaction Response Time Exception Handling Reporting

Page 25: Automation Testing Training(QTP)

Normal:This mode is the default and takes full advantage of Quick Test's test object model, recognizing the objects in your application regardless of their location on the screen

Analog Recording:Enables you to records the exact mouse and keyboard operations you perform in relation to either the screen or the application window. In this recording mode, Quick Test record and tracks every movement of the mouse as you drag the mouse around a screen or window. User cannot edit analog recording steps from within Quick Test

Recording Modes in QTP

Page 26: Automation Testing Training(QTP)

Low Level Recording:Enables you to record on any object in your application, whether or not Quick Test recognizes the specific object or the specific operation. This mode records at the object level and records all run-time objects as Window or Win Object test objects. Use low-level Recording for Recording tests in an environment or on an object not recognized by Quick Test. You can also use low-level Recording if the exact coordinates of the object are important for your test.

Recording Modes in QTP

Page 27: Automation Testing Training(QTP)

What you need to Know in QTP? How are the objects recognized? What is Object Repository? What is Object Recognition configuration? What is Active Screen? What is Keyword View and Expert View? What are Actions? What are the checkpoints available? Output Values Synchronization Point Data Driven Test? Transaction Response Time Exception Handling Reporting

Page 28: Automation Testing Training(QTP)

Object Repository

Object Repository acts as a translator between QTP script and the Operating System ( similar to GUI map concept in win runner).

QTP stores information it learns about a window or an object in object repository

When QTP runs a test, it uses the object repository to locate objects. QTP reads an objects description in the repository and then looks for an object with the same properties in the application under test.

Page 29: Automation Testing Training(QTP)

How QTP Stores Objects

ObjectRepository

QTP TEST SCRIPT

Generates Script Add objects using object identification

settings

Page 30: Automation Testing Training(QTP)

Types of Object Repositories

◦ Per Action Object Repository

◦ Shared Object Repository

Object Repository

Page 31: Automation Testing Training(QTP)

Object Repository Per Action

ObjectRepository

TEST 1

ACTION 1ACTION 2

TEST 2

ACTION 1ACTION 2

ObjectRepository

ObjectRepository

ObjectRepository

Page 32: Automation Testing Training(QTP)

Shared Object Repository

TEST 1

ACTION 1ACTION 2

TEST 2

ACTION 1ACTION 2

ObjectRepository

Page 33: Automation Testing Training(QTP)

Per Action vs. Shared Object Repository

Per Action Object Repository

Separate action repository for each action.

If an object description changes, you need to modify the object in every action repository using that object.

No need for any Object Repository administrator.

Preferred method if application won’t change during renovation

Default Object Repository. Preferable for novice QTP users.

Shared Object Repository

can use the same shared object repository file for multiple tests.

If an object description changes, you only have to modify in the shared Object Repository – all tests will playback properly.

Requires Shared object repository creation and maintenance.

Crucial if application may change during renovation

Most commonly used across Automation projects.

Page 34: Automation Testing Training(QTP)

What you need to Know in QTP?

How are the objects recognized? What is Object Repository? What is Object Recognition configuration? What is Active Screen? What is Keyword View and Expert View? What are Actions? What are the checkpoints available? Output Values Synchronization Point Data Driven Test? Transaction Response Time Exception Handling Reporting

Page 35: Automation Testing Training(QTP)

To identify objects uniquely, object identification configuration can be done. User can configure Mandatory, Assistive properties and ordinal identifier ◦ Examples:

List Box Combo Box Text Box Text Area

Object Recognition configuration

Page 36: Automation Testing Training(QTP)

Smart Object Identification Smart Object Identification to Ensure Successful Test

Execution

A sophisticated object recognition mechanism allows tests to automatically recover when object properties are not found during execution. Quick Test now evaluates application object properties upon test playback, and can make decisions based on logical property matches, even if the recorded object properties are not present.

Page 37: Automation Testing Training(QTP)

Smart Object Identification

Base filter propertiesThe most fundamental properties of a particular test object class; those whose values cannot be changed without changing the essence of the original object. For example, if a Web link's tag was changed from <A> to any other value, you could no longer call it the same object.

Optional filter propertiesOther properties that can help identify objects of a particular class as they are unlikely to change on a regular basis, but which can be ignored if they are no longer applicable

How does Smart Identification process work?

Page 38: Automation Testing Training(QTP)

What you need to Know in QTP?

How are the objects recognized? What is Object Repository? What is Object Recognition configuration? What is Active Screen? What is Keyword View and Expert View? What are Actions? What are the checkpoints available? Output Values Synchronization Point Data Driven Test? Transaction Response Time Exception Handling Reporting

Page 39: Automation Testing Training(QTP)

While recording the screen is captured and stored. In the tool the same can be seen as “Active Screen”

The same can be updated by using “Change Active Screen” Option

What is Active Screen?

Page 40: Automation Testing Training(QTP)

How are the objects recognized? What is Object Repository? What is Object Recognition configuration? What is Active Screen? What is Keyword View and Expert View? What are Actions? What are the checkpoints available? Output Values Synchronization Point Data Driven Test? Transaction Response Time Exception Handling Reporting

What you need to Know in QTP?

Page 41: Automation Testing Training(QTP)

Keyword View

Expert View

Script View

Page 42: Automation Testing Training(QTP)

Keyword View

Page 43: Automation Testing Training(QTP)

Expert View

Page 44: Automation Testing Training(QTP)

What you need to Know in QTP?

How are the objects recognized? What is Object Repository? What is Object Recognition configuration? What is Active Screen? What is Keyword View and Expert View? What are Actions? What are the checkpoints available? Output Values Synchronization Point Data Driven Test? Transaction Response Time Exception Handling Reporting

Page 45: Automation Testing Training(QTP)

Actions help divide your test into logical units

Group of Statements to perform certain action

Actions can be nested

Multiple actions can be called in a single test Splitting Actions Calling Actions Using Action Parameters Impact on Object Repository

What are Actions?

Page 46: Automation Testing Training(QTP)

Three Types◦ Non–reusable◦ Re-usable◦ External

Actions can divide a test into several distinct business Processes.

Each actions signifies a logical independent test. To divide a test into actions you can

◦ Insert a New Action◦ Split an existing action into two Actions◦ Insert a copy of an existing Action◦ Insert a call to an existing Action

In this way several actions can be integrated to each other within the test or across different tests logically.

Actions

Page 47: Automation Testing Training(QTP)

What you need to Know in QTP?

How are the objects recognized? What is Object Repository? What is Object Recognition configuration? What is Active Screen? What is Keyword View and Expert View? What are Actions? What are the checkpoints available? Output Values Synchronization Point Data Driven Test? Transaction Response Time Exception Handling Reporting

Page 48: Automation Testing Training(QTP)

Checkpoints

A checkpoint is a step in your test that compares the actual values of a specified object property to an expected value of the same property

Like,

Verify text in status barVerify value in a grid Verify bitmaps (Tick mark in Release strategy )

Page 49: Automation Testing Training(QTP)

Various Checkpoints are available

◦ Standard Checkpoint(Page/Table/Image/object)◦ Text / Text Area Checkpoint◦ Bitmap Checkpoint◦ Database Checkpoint◦ XML Checkpoint(File/Webpage)◦ Accessibility Checkpoint

Checkpoints

Page 50: Automation Testing Training(QTP)

What you need to Know in QTP?

How are the objects recognized? What is Object Repository? What is Object Recognition configuration? What is Active Screen? What is Keyword View and Expert View? What are Actions? What are the checkpoints available? Output Values Synchronization Point Data Driven Test? Transaction Response Time Exception Handling Reporting

Page 51: Automation Testing Training(QTP)

Output Values

An Output value is a step in which one or more values are captured at a specific point in the test

◦ Can capture status bar messages◦ Can capture object properties and text◦ Can store the values in a variable or table

Text / Text Area Output Value Bitmap Output Value Database Output Value XML Output Value(File/Webpage) Standard Output Value

Page 52: Automation Testing Training(QTP)

How are the objects recognized? What is Object Repository? What is Object Recognition configuration? What is Active Screen? What is Keyword View and Expert View? What are Actions? What are the checkpoints available? Output Values Synchronization Point Data Driven Test? Transaction Response Time Exception Handling Reporting

What you need to Know in QTP?

Page 53: Automation Testing Training(QTP)

A synchronization point is a line in the test script that instructs QTP to wait for a certain response from the application during playback.

What is a Synchronization Point?

Page 54: Automation Testing Training(QTP)

Without synchronization point

With synchronization point

Why Synchronize?

Inputs data to AUT

Acceptsinput

Run scriptScr

ipt

AUT

Sends data to database server

Attemptsnext step

Waits for server; cannot continue

Script fails

Sends data to database serverWaits

ContinuesClient affirms transaction is complete

Inputs datato AUT

Acceptsinput

Scrip

t

AUT

Run script

Page 55: Automation Testing Training(QTP)

Locate the lines in the script to insert the synchronization point

In Quick Test choose Insert > Step > Synchronization Point. The mouse pointer turns into a pointing hand. This should be done while recording.

Using the Hand Pointer click on the object to Synchronize.

Add Synchronization Point dialog box opens.

Process To Add Synchronization Points

Page 56: Automation Testing Training(QTP)

Select the Property name and its corresponding value which you want to use for the synchronization point.

Enter the synchronization point timeout (in milliseconds) and Click OK. A Wait Property step is added to your test.

For e.g. for this case the step inserted in the script will be Dialog (“Login”) . WaitProperty "enabled", 1, 10000

Synchronization

Page 57: Automation Testing Training(QTP)

How are the objects recognized? What is Object Repository? What is Object Recognition configuration? What is Active Screen? What is Keyword View and Expert View? What are Actions? What are the checkpoints available? Output Values Synchronization Point Data Driven Test? Transaction Response Time Exception Handling Reporting

What you need to Know in QTP?

Page 58: Automation Testing Training(QTP)

QTP supports Data Driven Testing

Can use the Data Driver Wizard to parameterize the tests

Stores data file with extension .XLS

Two types of sheets within the data table “Global” and “Action”

Data in “Global” is available across all actions in the test

Data in “Action” is available only to that action

Data Driven Testing

Page 59: Automation Testing Training(QTP)

Parameterization allows us to pick different values at run time.

Reduces Time and Effort.

Usage of data drivers allow us to use the same data for various input boxes.

Parameterization can also be done for checkpoints.

Parameterization

Page 60: Automation Testing Training(QTP)

What you need to Know in QTP?

How are the objects recognized? What is Object Repository? What is Object Recognition configuration? What is Active Screen? What is Keyword View and Expert View? What are Actions? What are the checkpoints available? Output Values Synchronization Point Data Driven Test? Transaction Response Time Exception Handling Reporting

Page 61: Automation Testing Training(QTP)

Transaction Response Time is used to measure the response time of any transaction

◦ Can be done for a single transaction◦ Can be done for multiple transactions

Results are logged in Test results log for every iteration

Response time measured from start to end of one iteration (within login and logoff)

Transaction Response Time

Page 62: Automation Testing Training(QTP)

What you need to Know in QTP?

How are the objects recognized? What is Object Repository? What is Object Recognition configuration? What is Active Screen? What is Keyword View and Expert View? What are Actions? What are the checkpoints available? Output Values Synchronization Point Data Driven Test? Transaction Response Time Exception Handling Reporting

Page 63: Automation Testing Training(QTP)

QTP can recover from unexpected events and/ or errors

Control can be transferred to a function

Useful, when running unattended

Every Script has at least one recovery scenario◦ Generic recovery scenario naming convention is

g<name>◦ Script specific recovery scenarios naming convention is

<Script ID>_<name>

Recovery scenarios

Page 64: Automation Testing Training(QTP)

Recovery scenarios In QTP

What is Recovery Scenario ?

How to Implement Recovery Scenario ?

Types of Recovery Scenario

Advantage of Recovery Scenario

Disadvantage of Recovery Scenario

Page 65: Automation Testing Training(QTP)

What is Recovery Scenario?

Recovery Scenario is used to control the execution flow of QTP script.

To Control the unexpected event or action perform by the application which we are going to automate.

Page 66: Automation Testing Training(QTP)

Recovery Scenario

Unexpected events, errors, popup window, message, link and application crashes during a test run can disrupt your test and distort test results. This is a problem particularly when running tests unattended—the test is suspended until you perform the action needed to recover.

Page 67: Automation Testing Training(QTP)

How to Implement Recovery Scenario.

In QTP the Recovery Scenario Manager provides a wizard that guides you through the process of defining a recovery scenario—a definition of an unexpected event and the operation's necessary to recover the test run.

Page 68: Automation Testing Training(QTP)

Record the Error on which you want to create recovery.

In QTP go to Tools Menu Option -> select the Recovery Scenario Manager.

How to Implement Recovery Scenario.

Page 69: Automation Testing Training(QTP)

Recovery Scenario Manager

Page 70: Automation Testing Training(QTP)

Recovery Event

Page 71: Automation Testing Training(QTP)

Recovery Condition

Page 72: Automation Testing Training(QTP)

Recovery Operation

Page 73: Automation Testing Training(QTP)

Run Option

Page 74: Automation Testing Training(QTP)

Save The Recovery Scenario

Page 75: Automation Testing Training(QTP)

After you have created recovery scenarios, you can associate one or more scenarios with a test in order to instruct Quick Test to perform the recovery scenario's during the test run if a trigger event occurs. The Recovery tab of the Test Settings dialog box lists all the recovery scenarios associated with the current test.

Tip

Page 76: Automation Testing Training(QTP)

To add a recovery scenario to a test

Page 77: Automation Testing Training(QTP)

Control the Execution flow of script.

Handle unexpected behavior of application.

User define Error Message.

Advantage of Recovery Scenario

Page 78: Automation Testing Training(QTP)

When we call Recovery scenario with On Every step option scrip execution become slow. Call only on Error.

Settings

Page 79: Automation Testing Training(QTP)

What you need to Know in QTP?

How are the objects recognized? What is Object Repository? What is Object Recognition configuration? What is Active Screen? What is Keyword View and Expert View? What are Actions? What are the checkpoints available? Output Values Synchronization Point Data Driven Test? Transaction Response Time Exception Handling Reporting

Page 80: Automation Testing Training(QTP)

Script can be executed in two ways Run

◦ Select Automation->Run Run from Step

◦ Select Automation->Run from Step

Execute Script

Page 81: Automation Testing Training(QTP)

Where the Test Results are storedTwo ways

◦ New folder is created for each run◦ Temp folder overwrites last run results

E.g..T:\QTP_SCRIPTS_FINAL\S007_015\Res1C:\DOCUME~1\SU2693\LOCALS~1\Temp\TempResults

Test Run

Page 82: Automation Testing Training(QTP)

Test Run

Page 83: Automation Testing Training(QTP)

Structure of a Test Result log

Results at an overall level and at step level

Results at action level rolled up to get summary of results

Screen shots help you to verify the flow

Screen shots available to identify the failures

Run time data is visible for debugging the failures

Analyze Results

Page 84: Automation Testing Training(QTP)

QTP Test/Step Outcome

Passed◦ Expected Vs actual is same

Failed◦ Expected Vs actual is different

Done◦ Step has been executed ◦ when unable to execute, marks the step as failed

Warning◦ Step has been executed but QTP logs a message

Test Results

Page 85: Automation Testing Training(QTP)

How to view the Test Results ◦ Select Test->Results

How to check the results of the past runs◦ Select Start->QTP->Test Results Viewer

How to delete the past test results◦ Select Start->QTP->Tools-> Test Results Deletion Tool

Test Results

Page 86: Automation Testing Training(QTP)

What you need to Know in QTP?

How are the objects recognized? What is Object Repository? What is Object Recognition configuration? What is Active Screen? What is Keyword View and Expert View? What are Actions? What are the checkpoints available? Output Values Synchronization Point Data Driven Test? Transaction Response Time Exception Handling Reporting

Page 87: Automation Testing Training(QTP)

?Thanks

Any Questions?