I am using Coded UI Testing (available in Microsoft Visual Studio 2015) and creating tests using the recorder. My tests work perfectly in my WPF application except where I have used "IntegerUpDown" control from the Extended.Wpf.Toolkit controls.
The normal approach when you encounter such a problem is to add the optional property AutomationId in your control in XAML. Then next time you record a test it uses that ID, thus uniquely identifying your XAML control. So for example, my button ...
<xctk:IntegerUpDown/>
becomes ...
<xctk:IntegerUpDown AutomationProperties.AutomationId="Nuid1" />
This is easy and works for all controls except the IntegerUpDown control that I have used. In the case of the IntegerUpDown, the CodedUI test sees the AutomationID of "AutoSelectTextBox" and not the value "Nuid1" that I have set. Where did this "AutoSelectTextBox" come from and why can I not set the AutomationID in the way that I do for standard WPF controls?
The problem with not being able to set the AutomationID is that recorded tests sometimes cannot tell which control is which. I therefore have say 3 IntegerUpDown controls on a XAML page. I record a test that adds 3 different values into each one. When my test plays back it enters the wrong values into the same box repeatedly instead of entering the value in the control that I used in my recording. There are other factors at play here because the Coded UI test sometimes can identify a control by other methods even when the AutomationID is not set but the underlying problem is that the IntegerUpDown control cannot have it's AutomationID set by me, the coder as this seems to be masked by a default AutomationID of "AutoSelectTextBox".
The normal approach when you encounter such a problem is to add the optional property AutomationId in your control in XAML. Then next time you record a test it uses that ID, thus uniquely identifying your XAML control. So for example, my button ...
<Button Width="75" Height="40">Click Me</Button>
Simply becomes...<Button Width="75" Height="40" AutomationProperties.AutomationId="Btn1">Click Me</Button>
And my IntegerUpDown control ...<xctk:IntegerUpDown/>
becomes ...
<xctk:IntegerUpDown AutomationProperties.AutomationId="Nuid1" />
This is easy and works for all controls except the IntegerUpDown control that I have used. In the case of the IntegerUpDown, the CodedUI test sees the AutomationID of "AutoSelectTextBox" and not the value "Nuid1" that I have set. Where did this "AutoSelectTextBox" come from and why can I not set the AutomationID in the way that I do for standard WPF controls?
The problem with not being able to set the AutomationID is that recorded tests sometimes cannot tell which control is which. I therefore have say 3 IntegerUpDown controls on a XAML page. I record a test that adds 3 different values into each one. When my test plays back it enters the wrong values into the same box repeatedly instead of entering the value in the control that I used in my recording. There are other factors at play here because the Coded UI test sometimes can identify a control by other methods even when the AutomationID is not set but the underlying problem is that the IntegerUpDown control cannot have it's AutomationID set by me, the coder as this seems to be masked by a default AutomationID of "AutoSelectTextBox".