TestComplete provides support for the most popular grid controls, including Microsoft DataGridView, Developer Express XtraGrid, Infragistics UltraGrid and others (for a full list, see Supported Controls). It automatically associates supported grid controls with program objects that provide testing functionality for the grid control with a number of properties and methods. You use those properties and methods to perform various testing operations over grid controls. For example, simulate mouse clicks on grid cells, get and set cell values, and so on.
As for any other grid controls, you can work with them in one of the following ways:
-
If TestComplete can access your grid control’s native properties and methods, you can use them in your tests. For instance, to get the value of a grid cell, your script code can use the grid’s internal method. For the list of applications whose internal properties and methods TestComplete can access, see About Open Applications.
-
If TestComplete cannot access your grid control’s native properties or methods:
-
You can simulate user actions over the grid control by using the Click
, DblClick
, Keys
, and other methods that TestComplete provides for all visual objects. You can also use low-level procedures to simulate mouse and keyboard events over the grid control.
-
You can use optical character recognition to simulate user actions over blocks of text that your grid control renders on the screen. For example, you can simulate mouse actions over the header caption’s text. In the same way, by using optical character recognition, you can capture and verify all the content that your grid control displays.
This section describes how to work with various Windows grid controls (examples are included). To learn how to work with Android grid view controls, see Working With Android Grid View Controls.
In This Section
Contains information about the support provided by TestComplete for grid controls.
Describes approaches that can be used to perform various operations over grid controls.
Explains how you can work with Borland TDBGrid controls.
Describes how to work with Developer Express QuantumGrid controls.
Describes how to work with Developer Express XtraGrid controls.
Describes how to work with Infragistics UltraGrid controls.
Describes how to work with Infragistics UltraWebGrid controls.
Describes how to work with Java Swing JTable controls.
Explains how to work with Microsoft DataGrid .NET controls.
Describes how to work with Microsoft DataGridView controls.
Explains how you can work with Microsoft PropertyGrid controls.
Describes how to work with the GridControl controls of the Syncfusion Essential Grid library.
Explains how you can work with the GridDataBoundGrid controls of the Syncfusion Essential Grid library.
Describes how you can work with the GridGroupingControl controls of the Syncfusion Essential Grid library.
Related Topics of Interest
Explains how to create checkpoints that verify data displayed in tabular controls.
Samples
TestComplete includes a number of sample projects that demonstrate how to work with various grid controls:
Borland TDBGrid:
<TestComplete Samples>\Desktop\Working With Grids\Borland TDBGrid
Borland StringGrid:
<TestComplete Samples>\Desktop\Working With Grids\Borland TStringGrid
Developer Express PropertyGrid:
<TestComplete Samples>\Desktop\Working With Grids\DevExpress PropertyGrid
Developer Express VerticalGrid:
<TestComplete Samples>\Desktop\Working With Grids\DevExpress VerticalGrid
Developer Express WPFGrid:
<TestComplete Samples>\Desktop\Working With Grids\DevExpress WPFGrid
Developer Express XtraGrid:
<TestComplete Samples>\Desktop\Working With Grids\DevExpress XtraGrid
Developer Express XtraVerticalGrid:
<TestComplete Samples>\Desktop\Working With Grids\DevExpress XtraVerticalGrid
Infragistics UltraGrid:
<TestComplete Samples>\Desktop\Working With Grids\Infragistics WinGrid
Infragistics XamDataGrid:
<TestComplete Samples>\Desktop\Working With Grids\Infragistics XamDataGrid
Swing JTable:
<TestComplete Samples>\Desktop\Working With Grids\JTable
Microsoft DataGridView:
<TestComplete Samples>\Desktop\Working With Grids\Microsoft DataGridView
Microsoft PropertyGrid:
<TestComplete Samples>\Desktop\Working With Grids\Microsoft PropertyGrid
QtTableWidget:
<TestComplete Samples>\Desktop\Working With Grids\QtTableWidget
Telerik RadGridView:
<TestComplete Samples>\Desktop\Working With Grids\Telerik RadGridView
TMS TAdvStringGrid:
<TestComplete Samples>\Desktop\Working With Grids\TMS TAdvStringGrid
Xceed GridControl:
<TestComplete Samples>\Desktop\Working With Grids\Xceed DotNetGrid
You can download more grid samples from http://support.smartbear.com/downloads/testcomplete/samples. The names of the sample scripts coincide with the names of the grid controls they test:
ComponentOne True DBGrid Pro
ComponentOne True DBGrid ProComponentOne True DBGrid ProThis script requires the sample application which is part of the Studio Enterprise trial download package that is available at http://www.componentone.com/Downloadcenter.aspx?PanelIndex=4. The script assumes that by default the application under test has the following path: <ComponentOne Studio>\True DBGrid Pro 8.0\Tutorials\OLEDB\Tutor20\Tutor20.exe. Before running the script, make sure that the TestComplete Tested Applications project item holds a valid link to the application to be tested (Tutor20.exe).
The script includes three custom routines that you can use in your scripts with minimum changes (if any). Each routine uses the direct access to grid cells.
-
The FindRowByCellValue
routine locates the grid’s row by the value held in the specified column.
-
The LogRowData
routine reads the contents of all the cells in the given row and posts it to the test log.
-
The LoadDataFromFile
routine adds a new row to the grid and populates it with values stored in a comma-separated values (CSV) file.
ComponentOne VSFlexGrid Pro
ComponentOne VSFlexGrid ProComponentOne VSFlexGrid ProThis script requires the sample application which is part of the Studio Enterprise trial download package that is available at http://www.componentone.com/Downloadcenter.aspx?PanelIndex=4. The script assumes that by default the application under test has the following path: <ComponentOne Studio>\VS FlexGridPro 8.0\Samples\Vb\CustDataSort\Project1.exe. Before running the script, make sure that the TestComplete Tested Applications project item contains a valid link to the application to be tested (Project1.exe).
The script includes three custom routines that you can use in your scripts with minimum changes (if any). Each routine uses the direct access to the grid cells.
-
The FindRowByCellValue
routine locates the grid’s row by the value held in the specified column.
-
The LogRowData
routine reads the contents of all the cells in the given row and posts it to the test log.
-
The LoadDataFromFile
routine adds a new row to the grid and populates it with values stored in a comma-separated values (CSV) file.
Janus GridEX
Janus GridEXJanus GridEXThis sample demonstrates how to work with Janus GridEX control v. 1 or 2 from scripts. The sample script requires a Janus GridEX 2000b ActiveX Control sample application available at http://www.janusys.com. The script assumes that by default the tested application has the following path: <Janus Systems Components>\Janus GridEX 2000\Samples\NorthWind\NorthWin.EXE. Before running the script, make sure that the TestComplete Tested Applications project item contains a valid link to the desired tested application (NorthWin.exe).
Before launching the script for the first time, it is necessary to run NorthWin.EXE and select the database for the grid which is located here: <Janus Systems Components>\Janus GridEX 2000\Samples\JSNWind.mdb.
The script includes several custom routines that you can use in your scripts with minimum changes (if any). These routines use the grid’s dataset.
-
The FindRowByCellValue
routine locates the grid’s row by the value held in the specified column.
-
The LogRowData
routine reads the contents of all cells in the given row and posts it to the test log.
-
The LoadDataFromFile
routine adds a new row to the grid and populates it with values stored in a comma-separated values (CSV) file.
-
The CloseAboutWin
routine is used to close the About window that is displayed when the tested application starts.
Janus GridEX v3
Janus GridEX v3Janus GridEX v3This sample demonstrates how you can work with Janus GridEX control ver. 3 from scripts. The sample script requires the sample application that is available at http://www.janusys.com. The script assumes that by default the tested application has the following path: <Janus Systems>\Controls for Microsoft .NET\Windows Forms Controls v3\Demos\Janus.NorthwindDemo.exe. Before running the script, make sure that the TestComplete Tested Applications project item contains a valid link to the desired tested application (Janus.NorthwindDemo.exe).
The script includes several custom routines that you can use in your scripts with minimum changes (if any). These routines use the grid’s dataset.
-
The FindRowByCellValue
routine locates the grid’s row by the value held in the specified
column.
-
The LogRowData
routine reads the contents of all cells in the given row and posts it to the test log.
-
The LoadDataFromFile
routine adds a new row to the grid and populates it with values stored in a comma-separated values (CSV) file.
-
The CloseReminderForm
routine is used to close the reminder window that is displayed when the tested application starts.
See Also
Object-Specific Tasks
Simulating User Actions
Supported Controls