** POST UPDATED **
For our system and integration tests on a Microsoft Dynamics environment, we are using Visual Studio 2010 Coded UI. I am an unexperienced user of Visual Studio, but have experience with test automation.
Whenever the VS-Coded-UI-test is typing text in edit boxes, there is a change that one of the characters that has to be typed is omitted. An address field like Beverly Hills 90210
could easily become Beverly ills 90210
, breaking my tests. It happens around 1 in the 200 characters (educated guess).
Has someone experienced this before? And where could the problem be located: Type rate of VS, Broken keyboard driver, Hiccup of the browser so it could not receive a text input properly, something else?
And is there a possibility to lower the typing rate of the test-driver in VS coded ui?
UPDATE, 2012-05-24: Still not found a solution. I use now a work around that reduce the change of failing, but it is still not ideal.
Work around code (yes, it is dirty):
// put this method in a base class or easy accessable component
protected void ExecuteWithRetry(Action method, int maxRetryCount = 2)
{
try
{
method();
}
catch (Exception)
{
if (maxRetryCount > 0)
{
ExecuteWithRetry(method, maxRetryCount - 1);
}
else
{
throw;
}
}
}
Whenever I use a piece of code where an text field is set, I call this through this method:
UIMap.SetUserfieldsParams.EnterAddress = @"555 Sunset Boulevard";
UIMap.SetUserfieldsParams.EnterZIP = @"90210";
ExecuteWithRetry(UIMap.SetUserfields);
UPDATE, 2012-06-18: It seems to be caused by the impersonation we use. The logged on user to our web-application is directly extracted from the AD server by the user name that started IE. By starting IE through impersonation, we can do our tests with other users without (manually) log off and log on into Windows. We use impersonation by using Process.Start(ProcessStartInfo startInfo)
in namespace System.Diagnostics.Process