synchronization points lesson

Post on 22-Feb-2016

46 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

Synchronization Points Lesson. Data Table Functions. Why Data Table Methods. To use Data Table methods, we need to consider Data Table as an object. Read the data placed in another action Data Table. . Randomized the data reading process, which otherwise reads in a sequential process. . - PowerPoint PPT Presentation

TRANSCRIPT

Synchronization Points Lesson

Data Table Functions

Why Data Table Methods

To use Data Table methods, we need to consider Data Table as an object.5

Read the data placed in another action Data Table. 4

Randomized the data reading process, which otherwise reads in a sequential process. 3

Change the Test Data placed in Data Table at run-time.2

Import Test Data sets available in excel format to the Data Table. 1

By using Data Table methods, we can:

Description of Data Table Object

PropertiesMethods

Run - Time

Data Table

Changes to the run-time DataTable object are reflected in the test results, but the design-time Data Table is not affected.

Note:

Types of Data Table Object

DTParameter

DTSheet

DataTable

Object Model

Description of Data Table

DataSheetDataParameter

Get Sheet Method

Import Sheet Method

Import Method

Get Current Row Method

Get Row Count Method

Set Current Row Method

Set Prev Row Method

Set Next Row Method

Raw Value Property

List of Associated Methods and Properties - DataTable

Value Property

Associated Properties and Methods

Data Table Object - Value Property

The Value is a default property of the Data Table. It retrieves or sets the value of the cell in the current row of the run-time Data Table.

DataTable.Value (ParameterID ,[SheetID]) Syntax to Retrieve:

DataTable.Value (ParameterID [,SheetID])=NewValue Syntax:

Examples of Value Property – Retrieving from Global Sheet

Example of Value Property – Retrieving from Local Sheet

Example of Value Property – Setting the Data Value

Run - Time

Run - Time

Data Table Object - RawValue Property

DataTable.RawValue (ParameterID ,[SheetID]) Syntax:

StringReturn Type:

The raw value property retrieves the raw value of the cell in the current row of the run-time Data Table. The raw value is the actual string written in a cell before the cell has been computed, such as,

the formula placed in the cell.

Example of RawValue Property

Data Table Object – SetNextRow Method

The SetNextRow method sets the row after the current row as new current row in the run-time Data Table.

DataTable.SetNextRow Syntax:

NoneReturn Type:

A row can be set only if it contains at least one value. If this method is applied on the last row of the Data Table, the first row of the Data Table is set as the new current row.

Note:

Example – SetNextRow Method

Data Table Object – SetPrevRow Method

The SetPrevRow method sets the row above the current (active) row as the new current (active) row in the run-time Data Table.

DataTable.SetPrevRow Syntax:

NoneReturn Type:

If the current row is the first row in the Data Table, applying this method sets the last row in the Data Table as the new current row.

Note:

Example – SetPrevRow Method

When the cursor is placed in the first row of the Data Table and the method is applied, the cursor goes to the last row of the Data Table.

Note:

Data Table Object – SetCurrentRow Method

The SetCurrentRow method sets the specified row as the current row in the run-time Data Table.

DataTable.SetCurrentRow(RowNumber) Syntax:

NoneReturn Type:

Example – SetCurrentRow Method

Data Table Object – GetRowCount Method

The GetRowCount method returns the total number of rows in a column in the run-time Data Table Global sheet.

DataTable.GetRowCount Syntax:

NumberReturn Type:

Example – GetRowCount Method

Data Table Object – GetCurrentRow Method

The GetCurrentRow method returns the current row in the run-time Data Table global sheet.

DataTable.GetCurrentRow Syntax:

NumberReturn Type:

Example – GetCurrentRow Method

Data Table Object – Import Method

The Import Method imports the specified Microsoft Excel file to the run-time Data Table. Its argument is a string which is the full path of the Excel table to be imported. This file can be present in the File System or in the Quality Center Path.

DataTable.Import(FileName) Syntax:

NoneReturn Type:

Example:

Verify that the column names are matching to the parameters in the test, and the sheet names are matching to the action names.

Note:QTP doesn’t give an error while importing when there is a

mismatch. But, it may not give the indented results while reading the data with parameter names.

Note:

File to be imported shouldn't be opened while executing the test script.

Note:

DataTable.Import(“C:\Data Tables\Table1.xls”)

Example - DataTable Import Method

Data Table Object – ImportSheet Method

The Import Sheet method imports a sheet of a specified file to a specified sheet in the run-time Data Table. The data in the imported sheet replaces

the data in the destination sheet.

Syntax:

Return Type:

Example:

DataTable.ImportSheet(FileName, SheetSource, SheetDest)

None

DataTable.ImportSheet ("C:\Contact.xls" ,”Sheet1” ,“Action1“)

Example – ImportSheet Method

GlobalSheet and LocalSheet

Data Table Commands

GlobalSheet / LocalSheet Properties

DTSheet Object

You can also use the method “DataTable .GetSheet” to get the DTSheet object.

Note:

Global Sheet Property

The Global sheet property returns the object of first sheet in the run-time Data table, which is the global sheet.

DataTable.GlobalSheet Syntax:

DTSheetReturn Type:

Example: Set objGlobal = DataTable.GlobalSheet

Local Sheet Property

The local sheet property returns the current active local sheet of the run-time Data table.

DataTable.Local SheetSyntax:

DTSheetReturn Type:

Example: Set objLocal = DataTable.LocalSheet

GetSheet Method

The Get Sheet method of Data Table object returns the specified sheet from the run-time Data table. Its syntax and examples are

shown on screen.

DataTable.GetSheet (SheetID) Syntax:

DTSheetReturn Type:

Example1:

Example2:

Set objGlobal = DataTable.GetSheet(1)

Set objLocal = DataTable.GetSheet(“Action1")

List of Commonly Associated Methods and Properties - DTSheet

Name Property

GetParameter Count Method

GetParameter Method

GetRowCount Method

GetCurrentRow Method

SetCurrentRow Method

SetPrevRow Method

SetNextRow Method

Commonly Associated Properties and Methods

Common Methods in DataTable and DTSheet Objects

GetCurrentRowSetCurrentRow

SetPrevRow

SetNextRow

Common MethodsDataTable DTSheet

GetRowCount

This method returns the number of rows in the longest column of given DT Sheet.

DTSheet.GetRowCount Syntax:

NumberReturn Type:

Example – GetRowCount

Name Property

The Name property returns the name of the data sheet at run-time.

DTSheet.Name Syntax:

StringReturn Type:

Example – Name Property

GetParameter CountMethod

Parameter in Data Table is similar to column in the excel sheet. The Get Parameter Count method returns the total number of parameters

in the Data sheet at run-time. .

DTSheet.GetParameterCount Syntax:

NumberReturn Type:

Example – GetParameterCount Method

GetParameter Method

The Get Parameter method retrieves the specified parameter from data sheet at run-time.

.

DTSheet.GetParameter(ParameterID)

Syntax:

DTParameter ObjectReturn Type:

Example – GetParameter Method

List of Properties Associated with DT Parameter

RawValue

ValueByRow

Value

Name

Associated Properties

Name Property (DTParameter Object)

The Data parameter object’s name property returns the name of a specified column in the run-time Data Sheet.

.

DTParameter.Name

Syntax:

StringReturn Type:

Example – Name Property (DataParameter Object)

Value Property

The Value property is the default property of DT Parameter object. It retrieves or sets the value of the cell in the current active row of the

parameter in the run-time Data table.

.

DTParameter.Value or DTParameter

Syntax to Retrieve:

DTParameter =newvalue Syntax to Set:

This method returns the computed value of the cell. For example, if the cell contains a formula, this property returns the computed value by replacing variables in the formula with the actual values.

Note:

Also, the word Value in the statement above can be omitted, because it is the default property for this object.

Note:

Example – Value Property DataParameter Object

To Retrieve:

To Set:

ValueByRow Property

The Value By Row property sets and retrieves value in the specified row of the parameter in the run-time Data sheet.

. DTParameter.ValueByRow(RowNum) Syntax:

DTParameter.ValueByRow(4) Example:

VariantReturn type:

Example – ValueByRow Property (DataParameter Object)

RawValue Property

The RawValue property returns the raw value of the cell in the current row of the parameter in the run-time Data Table.

.

DTParameter.RawValue

Syntax:

StringReturn Type:

Example – RawValue Property (DataParameter Object)

s

top related