Sie sind auf Seite 1von 29

Functional Testing with Mercury Quick Test Professional

Niranjan Dash, Rajini G. SHARP Automation

Client Logo

Agenda
Basic Automation using QTP - Functional Testing Overview - Functional Testing Elements - Script Development with QTP - QTP Automation Benefits - Record and Run - Checkpoints and Synchronization Advanced QTP Features - Parameterization - Multiple Actions - Recovery Scenario - Runtime Objects & Test Objects - Object Identification - Test Results

Client Logo

Functional Testing Overview


Definition
Certify the application from a business perspective

Process
Validate application functions against the functional specification, i.e., functions yield the expected results? Report and track defects Measure test coverage and track application quality

Client Logo

Functional Testing Elements


Test Environment (People, Processes, Hardware)
Dedicated people, infrastructure, test database(s)

Test Case Inventory (Excel or TestDirector)


Documented inventory of tests (Step, Action, Data, Expected Result)

Test Script Development (QuickTestPro)


Convert documented test case into reusable automated script

Test Case Execution (Manual, QTP, or TestDirector)


Execute test cases, document results

Defect Reporting (Excel or TestDirector)


If Actual Result = Expected Result, raise defect

Test Coverage (Excel or TestDirector)


What percentage of application functions tested?

Quality Measurement (Excel or TestDirector)


Trended rate of finding / fixing defects Client Logo

QTP Automation Benefits

Client Logo

Script Development with QTP

Client Logo

QTP Demonstration

Client Logo

Record and Run


Recording levels
Standard recording Analog recording Low level recording

Run modes
Normal Speed Update run

Client Logo

Data types in QTP


Some of the supported data types in QTP:
- String, Integer, Boolean, Decimal, Date, Variant

Variable Declaration
-Dim sText -Dim iNumber -Dim aArray() Dynamic Array -Dim aArray(10, 2, 5)

Variable Assignment
-sText = String Value -iNumber = 10 -aArray = (ABC, XYZ)

Client Logo

Scripting in QuickTestPro
Note: VB Script is used in QuickTestPro for automating Testcases. Function Screen_Display(sButtonName1,sButtonName2) Window("OsaSimulator").Page("Page").WebButton("name:="&sButtonName1).Click Window("OsaSimulator").Page("Page").WebButton("Apply").Click Window("OsaSimulator").Page("Page").WebButton("name:="&sButtonName2).Click bScreen = Window("OsaSimulator").Page("Page").WebEdit("Screen").Exist If bScreen Then reporter.ReportEvent micPass, "Custom Step", "Pass: Verify the " & sButtonName2 & " screen displays" Report_Result 4, "Verify the " & sButtonName & " screen displays", "Pass" Else reporter.ReportEvent micFail, "Custom Step", "Fail: Verify the " & sButtonName2 & " screen displays" Report_Result 4, "Verify the " & sButtonName & " screen displays", "Fail" End If End Function
Client Logo

Expected Result Checkpoints

Client Logo

Window("Flight Window("Flight Window("Flight Window("Flight Window("Flight Window("Flight Window("Flight Window("Flight Window("Flight Window("Flight Window("Flight true, 10000 Window("Flight

Reservation").Activate Reservation").WinButton("FLIGHT").Check CheckPoint("FLIGHT") Reservation").WinObject("Date of Flight:").Type "111111" Reservation").WinComboBox("Fly From:").Select "Frankfurt" Reservation").WinComboBox("Fly To:").Select "Los Angeles" Reservation").WinButton("FLIGHT").Check CheckPoint("FLIGHT_2") Reservation").WinButton("FLIGHT").Click Reservation").Dialog("Flights Table").WinButton("OK").Click Reservation").WinEdit("Name:").Set "aaaa" Reservation").WinButton("Insert Order").Click Reservation").WinButton("Update Order").WaitProperty "enabled", Reservation").WinButton("Button").Click

Client Logo

Synchronization
Options to Synchronize tests
Call wait Exist wait property Sync

Client Logo

Advanced QTP Features

Client Logo

Parameterizing Testing
Different groups of parameters
Data table parameter Other parameters

Data driver

Client Logo

Working with Multiple Actions


Action Creating Actions Divide the test into multiple actions - Step > Split Action Inserting call to new action - Insert > Call to New Action Inserting existing - Insert > Call to Copy of Action - Insert > Call to Existing Action Setting action as Reusable
Client Logo

Recovery Manager and Scenarios


Use of recovery scenario Recovery scenario consists of the following Trigger event Recovery Operation Post recovery test run option To create a recovery file Open the recovery scenario manager - Define a trigger event that interrupts the run session - Specifying the recovery operations required to continue - Choosing a post recovery test operation - Specifying a name & description for the recovery scenario - Specifying whether to associate this scenario to the current test or all new tests
Client Logo

Client Logo

Client Logo

Importance of Object Repository


Object repository Object identification Identification techniques Mandatory & Assistive property Ordinary identifier Smart identification How can we add objects to repository By recording Through active screen Add objects Types of repositaries Per action mode (.mtr) Shared mode (.tsr)

Client Logo

Client Logo

Test Objects & Runtime Objects


Test Objects (TO)
Used by QT to represent objects
in AUT TO property set created and maintained by QT, captured from AUT during recording Based on runtime object properties, but not necessarily 1-1 mapping QT uses stored TO properties to identify AUT objects during test run Access TO properties using GetTOProperty Access TO methods directly

Run-Time Objects (RO)


Actual live objects in AUT RO property set created and
maintained by AUT, queried from RO by QT Access runtime property values (runtime value of property defined by QT) using .GetROProperty Access native object properties using .Object Access native object methods using .Object

Client Logo

Object Identification & Smart Identification


QTP identifies run-time objects based on TO properties whose values are compared with the RO values Recorded Mandatory + Assistive properties become mandatory object description used during replay Smart Identification used when the object cant be identified (during replay only) Smart Identification is only invoked during replay, if enabled for the particular object class. During the recording phase QTP records properties for Smart Identification, but doesnt use them until Smart Identification is invoked
Client Logo

Match Object Description

One Object?

Is Smart Identification Create a list of objects (within Match base Smart turned on for this object the ID? parent object) that match properties class? the description (mandatory + recorded assistive properties) that were recorded for this One Are there more than two object. Object &(If Smart Identification Object? Multiple Identification objects in the list? Objects? there was only one, wed Forget everything we know, have returned it). Does this object If the selector location, index, for or this object identifies an object creation time selector? in the original set, return the object. If not error.
Smart ID successfully used to identify object (but have a ordinal identifier) used

Create a list of objects under the parent object that match all the base properties for this object class.

Selector?

start over from scratch Optional and look for the object Props? based on what we think it should look like

Use Selector Error Multiple objects

Return Object

Error Object not found

Warning: Identification would probably not have been possible without Smart ID check your Object Repository!

Filter by next optional property Legend


Yes No Client Logo

Smart Identification
Properties for Smart ID are recorded, but not used during replay When Smart ID is invoked, QT uses the properties that were recorded to identify the object Base and Optional Filter properties for Smart Identification must be set before-hand (so that QTP knows to record them). Use only if required. Because QTP has to record more properties, enabling Smart Identification degrades performance

Client Logo

Smart Identification
Configuring Smart Identification Tools Object Identification Disable for specific object Disable for test run Temporarily disable Smart Identification during replay Set App = CreateObject("QuickTest.Application") App.Launch App.Test.Settings.Run.DisableSmartIdentification = True App.Test.Settings.Run.DisableSmartIdentification = False Smart Identification in Test Results Client Logo Smart Identification Warning in Test Results

Test Results

Client Logo

Questions?

Client Logo

Thank you!

Client Logo

Das könnte Ihnen auch gefallen