1 / 49

Synchronization Points Lesson

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. .

cara
Download Presentation

Synchronization Points Lesson

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Synchronization Points Lesson Data Table Functions

  2. 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. Change the Test Data placed in Data Table at run-time. Import Test Data sets available in excel format to the Data Table. By using Data Table methods, we can: 5 4 3 2 1

  3. Description of Data Table Object Data Table Run - Time Note: Changes to the run-time DataTable object are reflected in the test results, but the design-time Data Table is not affected. Properties Methods

  4. Types of Data Table Object Object Model DataTable DTSheet DTParameter

  5. Description of Data Table DataSheet DataParameter

  6. List of Associated Methods and Properties - DataTable Associated Properties and Methods Value Property Raw Value Property Set Next Row Method Set Prev Row Method Set Current Row Method Get Row Count Method Get Current Row Method Import Method Import Sheet Method Get Sheet Method

  7. 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:

  8. Examples of Value Property – Retrieving from Global Sheet

  9. Example of Value Property – Retrieving from Local Sheet

  10. Example of Value Property – Setting the Data Value Run - Time Run - Time

  11. Data Table Object - RawValue Property 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. DataTable.RawValue(ParameterID ,[SheetID]) Syntax: Return Type: String

  12. Example of RawValue Property

  13. 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: Note: 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. Return Type: None

  14. Example – SetNextRow Method

  15. 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. Note: DataTable.SetPrevRow Syntax: 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. Return Type: None

  16. Example – SetPrevRow Method Note: 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.

  17. 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: Return Type: None

  18. Example – SetCurrentRow Method

  19. 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: Return Type: Number

  20. Example – GetRowCount Method

  21. Data Table Object – GetCurrentRow Method The GetCurrentRow method returns the current row in the run-time Data Table global sheet. DataTable.GetCurrentRow Syntax: Return Type: Number

  22. Example – GetCurrentRow Method

  23. 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: Note: Note: Note: File to be imported shouldn't be opened while executing the test script. Verify that the column names are matching to the parameters in the test, and the sheet names are matching to the action names. 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. Return Type: None DataTable.Import(“C:\Data Tables\Table1.xls”) Example:

  24. Example - DataTable Import Method

  25. 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: DataTable.ImportSheet(FileName, SheetSource, SheetDest) Return Type: None Example: DataTable.ImportSheet("C:\Contact.xls" ,”Sheet1” ,“Action1“)

  26. Example – ImportSheet Method

  27. GlobalSheet and LocalSheet DTSheet Object Data Table Commands Note: You can also use the method “DataTable .GetSheet” to get the DTSheet object. GlobalSheet / LocalSheet Properties

  28. 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: Return Type: DTSheet Example: Set objGlobal=DataTable.GlobalSheet

  29. Local Sheet Property The local sheet property returns the current active local sheet of the run-time Data table. DataTable.LocalSheet Syntax: Return Type: DTSheet Example: Set objLocal=DataTable.LocalSheet

  30. 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. Syntax: DataTable.GetSheet (SheetID) Return Type: DTSheet Example1: SetobjGlobal= DataTable.GetSheet(1) Example2: Set objLocal = DataTable.GetSheet(“Action1")

  31. List of Commonly Associated Methods and Properties - DTSheet Commonly Associated Properties and Methods SetNextRow Method SetPrevRow Method SetCurrentRow Method GetCurrentRow Method GetRowCount Method GetParameter Method GetParameter Count Method Name Property

  32. Common Methods in DataTable and DTSheet Objects DataTable Common Methods DTSheet SetNextRow SetPrevRow SetCurrentRow GetCurrentRow

  33. GetRowCount This method returns the number of rows in the longest column of given DT Sheet. DTSheet.GetRowCount Syntax: Return Type: Number

  34. Example – GetRowCount

  35. Name Property The Name property returns the name of the data sheet at run-time. DTSheet.Name Syntax: Return Type: String

  36. Example – Name Property

  37. 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: Return Type: Number

  38. Example – GetParameterCount Method

  39. GetParameter Method The Get Parameter method retrieves the specified parameter from data sheet at run-time. . DTSheet.GetParameter(ParameterID) Syntax: Return Type: DTParameter Object

  40. Example – GetParameter Method

  41. List of Properties Associated with DT Parameter Associated Properties Name Value ValueByRow RawValue

  42. 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: Return Type: String

  43. Example – Name Property (DataParameter Object)

  44. 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.ValueorDTParameter Syntax to Retrieve: Note: Note: 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. Also, the word Value in the statement above can be omitted, because it is the default property for this object. Syntax to Set: DTParameter=newvalue

  45. Example – Value Property DataParameter Object To Retrieve: To Set:

  46. 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: Variant Return type: Example: DTParameter.ValueByRow(4)

  47. Example – ValueByRow Property (DataParameter Object)

  48. 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: Return Type: String

  49. Example – RawValue Property (DataParameter Object) s

More Related