0

I'm not authorized to show the code but I have a problem:

When using the recording feature of CUIT on VS 2015, The test yields an error part way through the playback.

A date entry field is a masked input string field like this "MM/DD/YYYY HH:MM". You can type the values freely into the field. The issue is when doing playback, CUIT attempted to enter the string value of what is captured in the control's final state as "05/09/2017 12:42". The "/" and ":" of the string's value causes the cursor to tab through the masked input, resulting in an erroneous entry. The actual string required to account for all of the tabbing is literally "05///09///2017 12::42" but when I use that hard-coded value, it errors out while attempting to check for the longer version. States that it can't set the control to that value.

Is there a way to tell the CUIT to evaluate an overridden value so that it doesn't try to enter the string stored within the control which contains "/" and ":"?

Joel
  • 97
  • 2
  • 13

1 Answers1

0

You need to modify the value in the ...ExpectedValues class that holds the recorded date-time. Coded UI sends the recorded characters (or more accurately, the values from the ...ExpectedValues class) to the application and the application you are testing adds the / and : characters in the approprate places. The Coded UI recorder records both the entered and the generated characters.

Change the recorded 05/09/2017 12:42 value to be 05092017 1242. This can be done via the UI Map editor if the same date-time is always needed. Commonly the date-times are provided via the data source of a data driven test, or they are generated by the test itself. In either case it should be easy to provide data without the / and : or to add code to remove them before they are used. The wanted values are then written, when the test runs, into the ...ExpectedValues class.

See here for some additional notes on the ...ExpectedValues class and on data driving tests.

Community
  • 1
  • 1
AdrianHHH
  • 13,492
  • 16
  • 50
  • 87