TestComplete 6 Sneak Peek - Support for Grid Controls
Test and Monitor | Posted June 29, 2007

TestComplete 6 is currently under development. The information contained in this article is not final and may change before release.

TestComplete 6 is now beta testing, so it’s time to tell you more about its new features.

At AutomatedQA, we receive a lot of questions and requests from TestComplete users concerning working with third-party controls, especially grids. Our developers have been working hard for months to improve this functionality, and we’ve achieved great results -- TestComplete version 6 supports the most popular grid controls. Currently, the following grid controls are in the list:

  • Microsoft DataGridView
  • Microsoft DataGrid (.NET version)
  • Developer Express XtraGrid
  • Developer Express QuantumGrid
  • Infragistics WinGrid
  • Syncfusion Essential Grid
  • Borland TDBGrid

(Of course, this list will be expanded in future versions.)

There will be no more ordinary coordinate clicks that fail after changing the grid layout and no more digging into the grid control’s internals in order to perform the needed actions by using the features of the grid control itself. TestComplete 6 provides you with smart recognition of grid controls and access to their individual cells.

You can work with grid controls in the same way as with Win32 and WPF controls. Grid controls are automatically associated with specific program objects that extend the grid’s “native” functionality with a number of supplementary methods and properties. Using these extended methods and properties, you can perform the following actions over the grid controls:

  • Get and set cell values,
  • Simulate clicks and double clicks on individual cells,
  • Expand and collapse rows,
  • Simulate clicks on column headers,
  • And more...

Now let’s see how support for grid control works. For this purpose, I’m going to use a sample C# application that has a DataGridView control:

To be able to work with a DataGridView control, the .NET Open Applications Support and Microsoft Controls Support plug-ins must be installed and enabled:

Click to display image

Once I have made sure that the required plug-ins are enabled, I can record a test script. I will modify values in some grid cells and sort the grid data.

The recorded script is as follows:

As you can see, TestComplete has recorded clicks on grid cells and column headers in a special way - as the ClickCell and ClickColumnHeader actions.

TestComplete let us not only record actions over grid controls, but also retrieve data from grid cells. In the sample grid, there is an unbound “Sub Total” column that displays the order total. Let’s make sure that the application calculates the total values correctly. To do this, I will modify the recorded script so that it calculates the expected total value and checks this value with the one displayed in the grid:

The added code does the following:

  • Calculates the expected Sub Total value, based on the item’s Unit Price, Quantity and Discount.
  • Gets the value from a grid cell in the third row (its index is 2) and the “Sub Total” column. To get the cell value, we use the wValue property.
  • Compares the two values and logs the comparison result.

After running the script, we get a test log, like in the image below. TestComplete generates detailed messages about what it does during the test, just like it would with any other type of testing:

Click to display image

As you can see, support for grid controls implemented in TestComplete 6 is easy-to-use and a real time saver for those who test applications with grids. Interaction with grid controls and access to their data will no longer be a problem.

For a complete list of changes made to TestComplete, see What’s New in TestComplete 6.


By submitting this form, you agree to our
Terms of Use and Privacy Policy

Thanks for Subscribing

Keep an eye on your inbox for more great content.

Continue Reading

Add a little SmartBear to your life

Stay on top of your Software game with the latest developer tips, best practices and news, delivered straight to your inbox