Tuesday 3 May 2011

Testing with Visual Studio Test - Playback failed - using generic search properties

If you do automation testing with Visual Studio you're likely to come across the "playback failed to find the control with the given search properties" error message for a control or window that has changing search properties.

 Here's an example and how you can make the search more generic for a better match: Here I'm using the test recorder to record entering some text to a new notepad file named "My File 2423.....txt". This works fine on playback so long as the file name doesn't change.


Double click your UIMap in Visual Studio to open up the UIMap design and navigate to the control we're going to edit.  Taking a look at the search properties generated below the search must match the file name, this causes problems if this file name changes or is dynamically generated.

UIMap search properties are customizable, we can fix this problem by making the search a bit more generic, in this case I'll have the search match contains "My File" and skip the other stuff.



Here I've renamed my notepad window to retest using the new search configuration, from within the UIMap editor a quick right click search:




Playback finds the newly named file "My File Changed.txt"

No comments:

Post a Comment