I recently ran into a problem when using Microsoft Test Manager for UI testing. When clicking on a row in a Bound DataGridView, I would receive a warning that a step couldn’t be recorded.

Then, when I imported the test into Visual Studio when I wanted to convert it to an Automated Test, that step would report;

Last action on Row was not recorded because the control does not have any good identification property.

After a quick search, I came across a Microsoft blog which describes how to rectify this issue;

http://blogs.msdn.com/b/gautamg/archive/2010/03/10/how-to-get-automation-working-properly-on-data-bound-wpf-list-or-combo-box.aspx

Basically, the issue is that the Test Manager resolves clicks in DataGrids and Lists by calling the .ToString() method on the item. If this function doesn’t return anything meaningful that the Test Manager can use, then the step isn’t recorded.

As I had bound my WPF DataGridView to an Observable Collection of Entities, I was simply able to override the .ToString() method in the Buddy Class for the Entity, which solved the problem quite nicely.

By |2017-07-24T08:33:18+01:00February 24th, 2013|Testing, WPF|0 Comments

About the Author:

Leave A Comment