How to keep MaskedEdit extenders from breaking CodedUITests? (Visual Studio 2010)
I'm trying to implement coded UI tests, but have run into a problem. 开发者_运维技巧Whenever the test runs across a textbox with a masked edit extender on it, it records the mask as part of the input but does not enter that mask when it "types" that input during a playback. Example: mask is "//____" for a date. If I enter 02 02 2010 the textbox correctly shows 02/02/2010 and the test correctly records 02/02/2010. However, when the test is run it inputs 02022010, which fails and causes the test to stop.
My current workaround is to place the statement that does the input into a try-catch block, and then manually adding a Mouse.Click([control that's got a mask attached]) call later in the process. This seems to cause the mask to "fire", and things are able to proceed. However, it's a real nuisance to do this, since this particular project makes EXTENSIVE use of masked extenders.
Does anyone know of a better way?
I've wrote an simple extension who handles Dutch dates, this extension can be downloaded from codeplex
精彩评论