Synchronization Points Lesson
description
Transcript of Synchronization Points Lesson
![Page 1: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/1.jpg)
Synchronization Points Lesson
Data Table Functions
![Page 2: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/2.jpg)
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:
![Page 3: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/3.jpg)
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:
![Page 4: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/4.jpg)
Types of Data Table Object
DTParameter
DTSheet
DataTable
Object Model
![Page 5: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/5.jpg)
Description of Data Table
DataSheetDataParameter
![Page 6: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/6.jpg)
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
![Page 7: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/7.jpg)
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:
![Page 8: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/8.jpg)
Examples of Value Property – Retrieving from Global Sheet
![Page 9: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/9.jpg)
Example of Value Property – Retrieving from Local Sheet
![Page 10: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/10.jpg)
Example of Value Property – Setting the Data Value
Run - Time
Run - Time
![Page 11: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/11.jpg)
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.
![Page 12: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/12.jpg)
Example of RawValue Property
![Page 13: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/13.jpg)
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:
![Page 14: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/14.jpg)
Example – SetNextRow Method
![Page 15: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/15.jpg)
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:
![Page 16: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/16.jpg)
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:
![Page 17: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/17.jpg)
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:
![Page 18: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/18.jpg)
Example – SetCurrentRow Method
![Page 19: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/19.jpg)
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:
![Page 20: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/20.jpg)
Example – GetRowCount Method
![Page 21: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/21.jpg)
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:
![Page 22: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/22.jpg)
Example – GetCurrentRow Method
![Page 23: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/23.jpg)
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”)
![Page 24: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/24.jpg)
Example - DataTable Import Method
![Page 25: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/25.jpg)
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“)
![Page 26: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/26.jpg)
Example – ImportSheet Method
![Page 27: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/27.jpg)
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:
![Page 28: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/28.jpg)
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
![Page 29: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/29.jpg)
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
![Page 30: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/30.jpg)
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")
![Page 31: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/31.jpg)
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
![Page 32: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/32.jpg)
Common Methods in DataTable and DTSheet Objects
GetCurrentRowSetCurrentRow
SetPrevRow
SetNextRow
Common MethodsDataTable DTSheet
![Page 33: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/33.jpg)
GetRowCount
This method returns the number of rows in the longest column of given DT Sheet.
DTSheet.GetRowCount Syntax:
NumberReturn Type:
![Page 34: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/34.jpg)
Example – GetRowCount
![Page 35: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/35.jpg)
Name Property
The Name property returns the name of the data sheet at run-time.
DTSheet.Name Syntax:
StringReturn Type:
![Page 36: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/36.jpg)
Example – Name Property
![Page 37: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/37.jpg)
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:
![Page 38: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/38.jpg)
Example – GetParameterCount Method
![Page 39: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/39.jpg)
GetParameter Method
The Get Parameter method retrieves the specified parameter from data sheet at run-time.
.
DTSheet.GetParameter(ParameterID)
Syntax:
DTParameter ObjectReturn Type:
![Page 40: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/40.jpg)
Example – GetParameter Method
![Page 41: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/41.jpg)
List of Properties Associated with DT Parameter
RawValue
ValueByRow
Value
Name
Associated Properties
![Page 42: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/42.jpg)
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:
![Page 43: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/43.jpg)
Example – Name Property (DataParameter Object)
![Page 44: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/44.jpg)
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:
![Page 45: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/45.jpg)
Example – Value Property DataParameter Object
To Retrieve:
To Set:
![Page 46: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/46.jpg)
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:
![Page 47: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/47.jpg)
Example – ValueByRow Property (DataParameter Object)
![Page 48: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/48.jpg)
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:
![Page 49: Synchronization Points Lesson](https://reader036.fdocuments.in/reader036/viewer/2022062410/568161d0550346895dd1c4ec/html5/thumbnails/49.jpg)
Example – RawValue Property (DataParameter Object)
s