UFT Test Process Part 2

UFT Test Process Part 2 , Types of Objects in UFT , Types of Statements in UFT Test
-----------------------------------------
c) Word Application Object

It is used to perform word application operations

Class value for creating Word Application Object- (“Word.Application”)
-------------------
d) Database Connection Object

It is used to connect to Databases

Note: Connection string only varies from one Database to another

Class value for creating Database Connection Object- ("Adodb.Connection")
-------------------
e) Database Recordset object


It is used to perform operations on Database Tables

 Class value for creating Database Recordset Object- ("Adodb.Recordset")
-------------------
f) Dictionary object

It is used to define Key, Value Pairs.

Class value for creating Dictionary Object- ("Scripting.Dictionary")
-------------------------------------------------
14) Error Handling (VBScript, UFT)

Handling expected and unexpected Errors

Expected Error: Whenever we use invalid input then we can expect errors

Scenarios for Unexpected Errors:
Resource Response
Availability of Resource
Insufficient Resource

    Using Conditional statements
    Using Built -in functions
    Using Option explicit statement
    Using On Error Resume Next
    Using Exit Statement
    Recovery Scenarios (UFT)
-------------------------------------------------------
4th Phase of UFT Test Process
-------------------------------
IV) Running and Debugging Tests

Running Tests:

    Step by Step (Using Debug Commands)
    Single Test Run (Using Run Command)
    Batch Testing
        Using "Test Batch Runner" Tool
        Using AOM Script ("QuickTest.Application")
        Using Driver Script
        Using ALM Tool
Debugging Tests:

What is debugging?
When debugging is required?
    Test is not showing any errors and Not providing correct output then Debugging is required.

x = a * b

How to debug?
Using vbscript debug commands and breakpoints

Important Debug Commands
Step into (F11)
Step Over (F10)
Step Out (Shift + F11)
Breakpoint (F9)
----------------------------------
5th Phase of UFT Test Process
-------------------------------
V) Analyzing Test Result
----------------------------------------

UFT Result Window

UFT Provides Test Result for every Test iteration if we use UFT Tool features like Checkpoints, Output values, Transaction points etc…

Define Test Result

If we use our own login then we need to define Test Result

Using Reporter Utility Object we can define Test Result

Example:
Dim a, b
a = 100
b = 50

If a > b Then
    Reporter.ReportEvent micPass, "Res1", "A is a Big Number"
    Else
    Reporter.ReportEvent micFail, "Res1", "B is a Big Number"
End If-------------------

Status of Test Result:
-------------------------
Pass
(If Expected = Actual)

Fail
(If Expected <> Actual)

Done
No Verification points, Test executing without Errors

Warning
Interruption during Test Execution.
----------------------------------------------------
6th Phase of UFT Test Process
-------------------------------
VI) Reporting Defects
----------------------
Functional Test Automation        Defect Management
-----------------------------------------------------------
UFT                    Manual
--------------------------------------------------------
UFT                    Bugzilla/Jira
--------------------------------------------------------
UFT                    ALM
--------------------------------------------------------
Note: By integrating UFT with ALM, we can send defects directly from UFT Result window to ALM Project.
---------------------------------------------
Types of Objects in UFT Test Automation
---------------------------------------------
We work with Four types of objects in UFT Test Automation

1) Run-time Objects

The Objects that present in the Application are called Run-time Objects

States of Run-time objects:

    Enabled Objects
    Disabled Objects
    Focused Objects
    Hidden Objects
    Visible Objects
------------------------------------------------------
b) Test Objects

Reference of Run-time objects are called Test Objects
    Constant Objects
    Dynamic Objects (handle using Regular Expressions)
    Duplicate Objects (Using Index property)

Run-Time Object        windows        VB        Web
-------------------------------------------------------------
Button            WinButton    VbButton    WebButton

Edit box        WinEdit        VbEdit        WebEdit

Browser            NA        NA        Browser

Page            NA        NA        Page

Link            NA        NA        Link
-------------------------------------------------------------------
c) Utility Objects

UFT reserved objects used for Testing and Result Reporting.

Ex:

SystemUtil

Windows based App

SystemUtil.Run "Path of the AUT"


Web based App

SystemUtil.Run "Path of the Browser", "URL"

Ex:

SystemUtil.Run "C:\Program Files\HP\Unified Functional Testing\samples\flight\app\flight4a.exe"

SystemUtil.Run "C:\Program Files\Internet Explorer\iexplore.exe", "www.google.com"
---------------------------------------------
d) Automation objects

File System Object

Excel Application Object

Word Application Object

Database Connection Object

Database Recordset Object

Dictionary Object
------------------------------------------------
Types of Statements in UFT Test / Test Script
------------------------------------------------

1) Object Calls / Test Object Statements

Ex:

Single Test Object

Syntax:

TestObject("ObjectName").Method / Operation

Ex:
Dialog("Login").Activate

Two Test Objects

Syntax:

Parent TestObject("ObjectName").Child TestObject("ObjectName").Method

Dialog("Login").WinButton("Cancel").Click

Three Test Objects

Parent TestObject("ObjectName").Child TestObject("ObjectName").Sub Chid TestObject("ObjectName").Method

Ex:
 Browser("MSN India - News, Cricket,").Page("Google").Link("Gmail").Click

2) Utility Statements
----------------------
SystemUtil.Run "C:\Program Files\HP\Unified Functional Testing\samples\flight_service\HPFlights_Service.exe" @@ hightlight id_;_Browser("MSN India - News, Cricket,").Page("Google").Link("Gmail")_;_script infofile_;_ZIP::ssf6.xml_;_

SystemUtil.Run "C:\Program Files\Internet Explorer\iexplore.exe", "www.gmail.com"


3) Declarations
-----------------
a) Variables

Dim a, b(4), c(), d(4, 5)

a= 10
b(0) = "India"
b(1) =100
b(2) =10.345
b(3) =#10/10/2010#
b(4) =123

d(0, 0) = "VBScript"

b) Constants

Const city ="London", num = 100

4) Flow Control Statements
--------------------------
a) Conditional Statements

Ex:

Dim a, b
a= 100
b= 20

If a > b Then
    Msgbox "A is a Big Number"
    Else
    Msgbox "B is a Big Number"
End If
---------------
b) Loop Statements

For i = 1 To 5 Step 1
    Msgbox i & " Hello UFT"
Next

5) Action Calls, Function Calls
--------------------------------
Ex:

Call Login()

6) Checkpoint Statements
------------------------
Window("Flight Reservation").WinEdit("Tickets:").Check CheckPoint("Tickets:")

7) Output Value Statements
-------------------------
Window("Flight Reservation").WinEdit("Name:").Output CheckPoint("Name:")

8) VBScript Statements
--------------------
Set

Dim

Constant

For

Etc....

9) Automation Objects Statements
--------------------------------
objExcel.Visible = True
objExcel.Workbooks.Add
objExcel.ActiveWorkbook.SaveAs "C:\Users\gcreddy\Desktop\QTP.xls"
----------------------------------------------------------------

0 comments:

Post a Comment