UFT Tutorial 14

UFT Class fourteen
(Parameterization Part 2 - Parameterization using Data Table Parameters)


3) Using Data Table Parameters


What is Data Table?


It is an integrated spread sail for Data related operations

How to launch:


View -> Data

> Data Table has 2 types of sheets

a) Global sheet

b) Actions sheets (Local sheets)

> Data Table located inwards 2 areas

a) In UFT tool primary window (Design-time Data Table)

b) UFT tool Result window (Run-time Data Table)

> It attaches i Data Table for every novel Test

Usage of Data Table:


a) Enter Test information conduct into Data Table together with connect to the Test.

b) Import information from external files (text or excel) together with into Data Table together with connect to the Test.

c) Import information from a Database together with into Data Table together with connect to the Test.

d) Using Data tabular array methods together with programmatic statements

Steps for Data Driven Testing using Data Table:


a) Generate the basic Test together with travel it once

b) Launch Data tabular array together with Enter or Import examination data.

c) Connect examination information to the Test

                Using Editor View
                Or
                Using Keyword view
                or
                Using Data Driver
d) Run the Test
-------------------------------
Syntax for connecting Test Data to the Test using Editor view


DataTable("Column Name"/Column Id, Sheet Name / Sheet Id)

Ex:

SystemUtil.Run "C:\Program Files\HP\Unified Functional Testing\samples\flight\app\flight4a.exe"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set DataTable(1, 1) 
Dialog("Login").WinEdit("Password:").Set DataTable(2, 1)
Wait 2
Dialog("Login").WinButton("OK").Click
Window("Flight Reservation").Close
---------------------------------------
Import Test Data from External files (Text or Excel)


i) Text file

> Data Table considers Text file kickoff trouble every bit Column headers

> In betwixt 2 columns Tab infinite is the delimiter
---------------
ii) Excel File

> Data Table considers Excel sail kickoff row every bit Column headers
------------------------------------------------------------------
c) Import information from a Database together with into Data Table together with connect to the Test.

Steps:

> Create a Database

> Create Tables

> Enter Data
---------
> Create DSN (Data Source Name)

Note: If you lot desire to connect to a Database thence Connection string (DSN) is required

> Connect Test Data
------------------------------
Creating DSN:

> Launch Data Table

> Place mouse pointer on Data Table together with Right Click

> Sheet > Import > From Database

> Select "Specify SQL disputation manually" option

> Click Next

> Click Create

> Click New

> Select Driver for our Database together with Click Next

> Browse path to shop DSN

> Click Next > Click Finish

> Click Select

> Browse database together with select

> Click OK > Click OK

> Enter SQL statement

> Click Finish
-------------------------------------
d) Using Data tabular array methods together with programmatic statements


Note: We insert programmatic statements inwards club to overcome around limitations of Tool features.

Ex:

'Create a novel sail inwards Run-time Data Table
DataTable.AddSheet "Login"

'Import Test information from an external file
Datatable.ImportSheet "C:\Users\G C Reddy\Desktop\abcd.xls", 1, "Login"

RowsCount = DataTable.GetSheet("Login").GetRowCount

For i = 1 To RowsCount Step 1
DataTable.SetCurrentRow(i)
SystemUtil.Run "C:\Program Files\HP\Unified Functional Testing\samples\flight\app\flight4a.exe"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set DataTable("Agent", "Login")
Dialog("Login").WinEdit("Password:").Set DataTable(2, 3)
wait 2
Dialog("Login").WinButton("OK").Click
Window("Flight Reservation").Close
Next
-------------------------------------------------
'Data Driven Testing using Data Table parameters together with programmatic statements

DataTable.AddSheet "Login"
DataTable.ImportSheet "C:\Users\G C Reddy\Desktop\abcd.xls", 1, 3

RowCount = DataTable.GetSheet("Login").GetRowCount
For i = 1 To RowCount Step 1
                Datatable.SetCurrentRow(i)
SystemUtil.Run "C:\Program Files\HP\Unified Functional Testing\samples\flight\app\flight4a.exe"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set DataTable(1, 3)
Dialog("Login").WinEdit("Password:").Set DataTable(2, 3)
wait 2
Dialog("Login").WinButton("OK").Click
If Window("Flight Reservation").Exist(12) Then
Window("Flight Reservation").Close      
DataTable(3, 3) = "Login Successful -Passed"
Else
SystemUtil.CloseDescendentProcesses
DataTable(3, 3) = "Login Unsuccessful -Failed"
End If
DataTable.ExportSheet "C:\Users\G C Reddy\Desktop\Result1.xls", "Login"
Next
------------------------------------
'Read Data from external file together with write Result together with fault messages

Dim RowCount, OrderNumber
'Data Driven Testing using Data Table parameters together with programmatic statements
DataTable.AddSheet "Login"
DataTable.ImportSheet "C:\Users\G C Reddy\Desktop\abcd.xls", 1, 3

RowCount = DataTable.GetSheet("Login").GetRowCount
For OrderNumber = 1 To RowCount Step 1
                Datatable.SetCurrentRow(OrderNumber)
SystemUtil.Run "C:\Program Files\HP\Unified Functional Testing\samples\flight\app\flight4a.exe"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set DataTable(1, 3)
Dialog("Login").WinEdit("Password:").Set DataTable(2, 3)
wait 2
Dialog("Login").WinButton("OK").Click

If Window("Flight Reservation").Exist(12) Then
Window("Flight Reservation").Close      
DataTable(3, 3) = "Login Successful -Passed"
Else
DataTable(4, 3) = Dialog("Login").Dialog("Flight Reservations").Static("Agent cite must endure at").GetROProperty("text")
SystemUtil.CloseDescendentProcesses
DataTable(3, 3) = "Login Unsuccessful -Failed"
End If
DataTable.ExportSheet "C:\Users\G C Reddy\Desktop\Result1.xls", "Login"
Next
-------------------------------------------------

Sumber http://www.gcreddy.com/
Post a Comment (0)
Previous Post Next Post